From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046760; cv=none; d=zohomail.com; s=zohoarc; b=n0Uv4vzHbCOXeaDUhe/Us1cQcGwLdZ3ktGkxetsyXOoju2bzlS03iKLDY+ZpTXkdm0SJ9EdAxRqRA+w78i/5FJN0XEEgb3YpoAeyMnQas2exyJG1FMTzXM/VA/vYWsOkjJl55DYjwyGqpiAyHfPgxM3RE81ryJarmnXXsLk+QIc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046760; 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=SSkRhzb3hdUii5pdYsRs72uZgeElz9D/Us23IyrCwco=; b=Ppk9/meYMnVSIy/7Bv/wQDztr9C8z0Xe8u7X6xftCIfpgER4yuFUPy1wDGNOsRLE3ePuxm8W0wJ1gdaPBUo3+Cv/Q7ZZOrYukNDLcIqdfO1JstOqrn7DPVuTvKitg/NUfHt8L7pyGuaaAr6tqkyAQdBztRD1/rpTsldb7mCmIe0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046760418233.5877212877756; Mon, 27 Apr 2020 21:06:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHUy-0000MP-8K; Tue, 28 Apr 2020 04:05:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHUx-0000MK-0Y for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:31 +0000 Received: from mail-qk1-x741.google.com (unknown [2607:f8b0:4864:20::741]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 7f625486-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:05:29 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id l78so20534399qke.7 for ; Mon, 27 Apr 2020 21:05:29 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:27 -0700 (PDT) X-Inumbo-ID: 7f625486-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SSkRhzb3hdUii5pdYsRs72uZgeElz9D/Us23IyrCwco=; b=lyDTN0WquyldQiEzSG09jVte+I38DXlC/EnL+OdK9omxTuORBc/Hqxq/pN45kk5GAN ff/9+l+GyOze/OyT1f4wCNYdT9kHHJitgJ+hDUhMlBdrSWaujt6w+neRAZ4nxPfgWCxB fr+bh0EVwr6cNRy38e4YgxMR7JNtDpCbZRBKlT24/ZLtLJYTguL2xmaA4UD2BDl2vWj8 MuVFDn+TJP67ed2DFHXs/dYnFdgjY8uqNKrz3pkscz19JQMZLZprmP2ae7CcI9CSxMaY xBtF+FA4p7FJ94Ktb8JqmR5wKFuWVbMFfYyb362UjIZkzuJVF3JkD9Tbd27HrLRSJ+6G aF7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SSkRhzb3hdUii5pdYsRs72uZgeElz9D/Us23IyrCwco=; b=E+f2c3fj3cCSvD4mmejR70F9OS8KftxTKbbbhnYuNthCNXJS5eQFknj+tNmyBe9dcj rOj0fWzgSNSKf+CohUK/2lsi6Q2pPvYDY73oMh1VJNBUTi3xipUgb7ZnTX7bIuGdNyxC ZE893S8tBtWKgQmSTj7KZLJQ92pXa5WTGQ7sjSCTlWNv+3oNVbL6F+CCKZPaCfvoPFDC jxZIN8DKcMXSoeTLSY7f3hCBs/BYxD+pzbXmHiPrfH97KZZDHajvTw3qNVQS7p2NEmpE j2riPvmrUJSE1I7Fu0JnCEMquJaPgJEwka/8nnyEP2DLKmq1sUY40Eb6bLKmRr9keP2g KURg== X-Gm-Message-State: AGi0PubaUh58JmN1Tv92/O26s8Z4Fqa26i75fCTLg4DOTtA6liLlHVNz z8pvEkypKVIRuS2AbAc+g0H3TYUNZL8= X-Google-Smtp-Source: APiQypJVEZhagpxazMsT4JZtYimyUeczpPaKVzJ3ppbhvW3zQ1eD9vYf5HId9dbCYWMnlgdu7Mzz0A== X-Received: by 2002:a37:638d:: with SMTP id x135mr23666881qkb.366.1588046728656; Mon, 27 Apr 2020 21:05:28 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 01/21] Document ioemu MiniOS stubdomain protocol Date: Tue, 28 Apr 2020 00:04:13 -0400 Message-Id: <20200428040433.23504-2-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Jason Andryuk , Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , George Dunlap , Jan Beulich , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Add documentation based on reverse-engineered toolstack-ioemu stubdomain protocol. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- docs/misc/stubdom.txt | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/docs/misc/stubdom.txt b/docs/misc/stubdom.txt index 882a18cab4..64c77d9b64 100644 --- a/docs/misc/stubdom.txt +++ b/docs/misc/stubdom.txt @@ -23,6 +23,59 @@ and https://wiki.xen.org/wiki/Device_Model_Stub_Domains = for more information on device model stub domains =20 =20 +Toolstack to MiniOS ioemu stubdomain protocol +--------------------------------------------- + +This section describe communication protocol between toolstack and +qemu-traditional running in MiniOS stubdomain. The protocol include +expectations of both qemu and stubdomain itself. + +Setup (done by toolstack, expected by stubdomain): + - Block devices for target domain are connected as PV disks to stubdomain, + according to configuration order, starting with xvda + - Network devices for target domain are connected as PV nics to stubdomai= n, + according to configuration order, starting with 0 + - if graphics output is expected, VFB and VKB devices are set for stubdom= ain + (its backend is responsible for exposing them using appropriate protocol + like VNC or Spice) + - other target domain's devices are not connected at this point to stubdo= main + (may be hot-plugged later) + - QEMU command line (space separated arguments) is stored in + /vm//image/dmargs xenstore path + - target domain id is stored in /local/domain//target xenstor= e path +?? - bios type is stored in /local/domain//hvmloader/bios + - stubdomain's console 0 is connected to qemu log file + - stubdomain's console 1 is connected to qemu save file (for saving state) + - stubdomain's console 2 is connected to qemu save file (for restoring st= ate) + - next consoles are connected according to target guest's serial console = configuration + +Startup: +1. PV stubdomain is started with ioemu-stubdom.gz kernel and no initrd +2. stubdomain initialize relevant devices +3. stubdomain signal readiness by writing "running" to /local/domain//device-model//state xenstore path +4. now stubdomain is considered running + +Runtime control (hotplug etc): +Toolstack can issue command through xenstore. The sequence is (from toolst= ack POV): +1. Write parameter to /local/domain//device-model//= parameter. +2. Write command to /local/domain//device-model//co= mmand. +3. Wait for command result in /local/domain//device-model//state (command specific value). +4. Write "running" back to /local/domain//device-model//state. + +Defined commands: + - "pci-ins" - PCI hot plug, results: + - "pci-inserted" - success + - "pci-insert-failed" - failure + - "pci-rem" - PCI hot remove, results: + - "pci-removed" - success + - ?? + - "save" - save domain state to console 1, results: + - "paused" - success + - "continue" - resume domain execution, after loading state from console = 2 (require -loadvm command argument), results: + - "running" - success + + + PV-GRUB =3D=3D=3D=3D=3D=3D=3D =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046757; cv=none; d=zohomail.com; s=zohoarc; b=OsiaCtzAd2BGmxyQWDRPRQ8LGJLsDOe9d8zqW1Vuw1ZwefhHoqKcyjTfD8loifyW1tGU8W6TPk+oSHtMOY/Sxn9PbxsFNP7njTr0WL1KigkZIHYjsy0h1DI7vrplnACnO/pUz+wEC/shi9e8bU0gf3SxmHbck56FFg7a9m9JOnA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046757; 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=ft2YmkVf5v7GMI2mzGT4dRGSFWsB0nPaCI36YbESKr8=; b=WHnkneS9OEHPa8Zi/kVTb4m9CtYgJ6vuEK6wrmN2Mmch1ygvLQ9s6erhJLXDKLM+OqZNj5Rjg/lTyLOhghNgAYjV+rDCf47bcT6OhjXbQ1b6smsoIf11FJ7AjC+qht9JCDzhlt0sJNNP7AijqoZ5cjuMTFGb6rjJrd405sCuBNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046757586145.3717317080817; Mon, 27 Apr 2020 21:05:57 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHV2-0000Mm-GT; Tue, 28 Apr 2020 04:05:36 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHV2-0000Mg-0q for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:36 +0000 Received: from mail-qt1-x843.google.com (unknown [2607:f8b0:4864:20::843]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 819d7a8c-8905-11ea-b07b-bc764e2007e4; Tue, 28 Apr 2020 04:05:33 +0000 (UTC) Received: by mail-qt1-x843.google.com with SMTP id e17so12874799qtp.7 for ; Mon, 27 Apr 2020 21:05:33 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:31 -0700 (PDT) X-Inumbo-ID: 819d7a8c-8905-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ft2YmkVf5v7GMI2mzGT4dRGSFWsB0nPaCI36YbESKr8=; b=sVEVcVYnKPJjrq4/ke5l41TPF1bRBUxnpkdzKAAetypbH0YtLcJQfHzW4NDxQAlx8h g9t6gKVPkzCGtikIs9K85o/VTn+0tHtOIL/Scau0Zo8w2c69prN9PuxxVPC29KIwEEBm TaQYvFGz1Q1o4hUuo+xgJOj8bGzEguc27tsBfGSGsq6NuRMhJa7rV3uB3UQbGdOI5RCz 4OXA25r3L2vAh2jTju3c2wkRc8tK3JcLSA3ffp2PGO/tglR8yStVqVXB/ZVSvRHFMWBc Oh1qCTOATZCBSDG3qWpaguqb7Pr36twkJwsWMThmVOKtBzHUnOMCH3DDNrORrh2DEIhb rO/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ft2YmkVf5v7GMI2mzGT4dRGSFWsB0nPaCI36YbESKr8=; b=DhsrpUoKiNHTthpiy8lucpuD3NoupMI7ObKqaQ+JB2MOuOyXRwqPxBh+VH7NTv7VW1 gIraHEg9ZHGCDwLx2PLJAVhPwU4buOO0z4jvcIFX8FNEVmznBde56F9TwLrE+YmNym2H jM++ReA8gkik06i/CfNYdqyme9nu+U5xgaibSjlMZqacIIA5r9s+L77poPLLNvFhdbJz KpPDt87qyblipgtZd0gDlJ77tbBUZz9Sc60fAZpqnc7SN3kznOmGqqtR2BC6XkhDD+Kf NF8Nn9I3CproDr5+nyXKbydso5QwTbT683rKHwxyQQARud6sz4EzXl8GG88YxTxz4ikI y48g== X-Gm-Message-State: AGi0Pub961nj07KQU4R56aTsfsiBwIgQoVZl7gS8J0f4IUsKYprz36k3 avgauVeoWomRT0DS7N9LVf5hc+vOVno= X-Google-Smtp-Source: APiQypIc5wyrWf8cCdgYHLVkj8RK8dV3U2UUDijNgtYbDYWMSmDJzl1Q9Dxovh2ORFbNzTqUnBk3rA== X-Received: by 2002:ac8:4818:: with SMTP id g24mr15395296qtq.377.1588046732407; Mon, 27 Apr 2020 21:05:32 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 02/21] Document ioemu Linux stubdomain protocol Date: Tue, 28 Apr 2020 00:04:14 -0400 Message-Id: <20200428040433.23504-3-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Jason Andryuk , Andrew Cooper , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , George Dunlap , Jan Beulich , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Add documentation for upcoming Linux stubdomain for qemu-upstream. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- docs/misc/stubdom.txt | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/misc/stubdom.txt b/docs/misc/stubdom.txt index 64c77d9b64..bb5e87dfb9 100644 --- a/docs/misc/stubdom.txt +++ b/docs/misc/stubdom.txt @@ -75,6 +75,56 @@ Defined commands: - "running" - success =20 =20 +Toolstack to Linux ioemu stubdomain protocol +-------------------------------------------- + +This section describe communication protocol between toolstack and +qemu-upstream running in Linux stubdomain. The protocol include +expectations of both stubdomain, and qemu. + +Setup (done by toolstack, expected by stubdomain): + - Block devices for target domain are connected as PV disks to stubdomain, + according to configuration order, starting with xvda + - Network devices for target domain are connected as PV nics to stubdomai= n, + according to configuration order, starting with 0 + - [not implemented] if graphics output is expected, VFB and VKB devices a= re set for stubdomain + (its backend is responsible for exposing them using appropriate protocol + like VNC or Spice) + - other target domain's devices are not connected at this point to stubdo= main + (may be hot-plugged later) + - QEMU command line is stored in + /vm//image/dmargs xenstore dir, each argument as separate = key + in form /vm//image/dmargs/NNN, where NNN is 0-padded argum= ent + number + - target domain id is stored in /local/domain//target xenstor= e path +?? - bios type is stored in /local/domain//hvmloader/bios + - stubdomain's console 0 is connected to qemu log file + - stubdomain's console 1 is connected to qemu save file (for saving state) + - stubdomain's console 2 is connected to qemu save file (for restoring st= ate) + - next consoles are connected according to target guest's serial console = configuration + +Environment exposed by stubdomain to qemu (needed to construct appropriate= qemu command line and later interact with qmp): + - target domain's disks are available as /dev/xvd[a-z] + - console 2 (incoming domain state) is connected with FD 3 + - console 1 (saving domain state) is added over QMP to qemu as "fdset-id = 1" (done by stubdomain, toolstack doesn't need to care about it) + - nics are connected to relevant stubdomain PV vifs when available (qemu = -netdev should specify ifname=3D explicitly) + +Startup: +1. toolstack starts PV stubdomain with stubdom-linux-kernel kernel and stu= bdom-linux-initrd initrd +2. stubdomain initialize relevant devices +3. stubdomain starts qemu with requested command line, plus few stubdomain= specific ones - including local qmp access options +4. stubdomain starts vchan server on /local/domain//device-mod= el//qmp-vchan, exposing qmp socket to the toolstack +5. qemu signal readiness by writing "running" to /local/domain//device-model//state xenstore path +6. now device model is considered running + +QEMU can be controlled using QMP over vchan at /local/domain//= device-model//qmp-vchan. Only one simultaneous connection is sup= ported and toolstack needs to ensure that. + +Limitations: + - PCI passthrough require permissive mode + - only one nic is supported + - at most 26 emulated disks are supported (more are still available as PV= disks) + - graphics output (VNC/SDL/Spice) not supported + =20 PV-GRUB =3D=3D=3D=3D=3D=3D=3D --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046755; cv=none; d=zohomail.com; s=zohoarc; b=Ef4NC6w7djbwU7FXBc0d4ML6d7VnTnQIxOa+GyZB0Zyl/oodvyq9Z2Z7L7H4zGaWg0lc8WlBbnulM4OgLUnVhOoS7Ij/pTLa2Lk+rpb/xtTX53OeNHGjl8N6YohqrpbVIQycDOZtGaC53t5nvJXHgurwd8Xs1Ls4cNFbuDp7H9c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046755; 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=MJ/wYWaIjP7f/7FREcfMpppu/JiqlH2FlZ3lrFsDLA4=; b=FoGlFfY3HvBvV8HU+2ZOsW9W1upy9cX2100YK046wMhQsF9Ue9FD/fjI+nQ17jTtPo77BPbKm8j18Q7NA1tpcSuBXedPQGyMCx8dpXCxvYllY2uEghZmlS0wGKucFhiYqPCCsuTDYhxT+tO7aJ9rVt++aoMfTO8fkky46/ZD574= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046755168371.43841290242085; Mon, 27 Apr 2020 21:05:55 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHV7-0000Nr-PL; Tue, 28 Apr 2020 04:05:41 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHV7-0000NG-14 for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:41 +0000 Received: from mail-qv1-xf44.google.com (unknown [2607:f8b0:4864:20::f44]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8493327c-8905-11ea-b07b-bc764e2007e4; Tue, 28 Apr 2020 04:05:38 +0000 (UTC) Received: by mail-qv1-xf44.google.com with SMTP id t8so9767793qvw.5 for ; Mon, 27 Apr 2020 21:05:38 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:36 -0700 (PDT) X-Inumbo-ID: 8493327c-8905-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MJ/wYWaIjP7f/7FREcfMpppu/JiqlH2FlZ3lrFsDLA4=; b=s/ry4TNhkeyiE/CLvIMK4n0nF/fmFPiReG/8ypM0JBO77Pxfbx9bmOZWUeGka/9g3n sVFSrodQSuasNMSayb9oShCWv5NHaqWYhDTc6xUA3C9CfVn4w9bY7tqDRiVNs4bq+I3f zkPBiNww8ZL+BQKA/V7uLnuR9u3mZoFXCsiHH8wZTLU9mWsFH5BMXJTQYFE9e8e4K7Fl 6DwirhucY+FSieVTDC8gAi2KgAYNs0OakeNDHEhLbEd2i9AwPwo0nSpWs4t01YMC2GBC FnYsHVwrRziElstqoP90yK7Qi4XNL7Y/gS74+QUL0BT9E3cdzaDthvBy6Se3q9DSvOBs jEuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MJ/wYWaIjP7f/7FREcfMpppu/JiqlH2FlZ3lrFsDLA4=; b=YX3dBevT/cC5e2XayThPn2zTfdBXrsqgGN0MMJIsrUogjgycytuAMmMfp2lQ/+igb0 VGA9NnW4nbQiprvu/AZyXZrjJK/kP5/3ICKKqLvw40m30fQ/y4HI+f59O9kODdk1qYRu xw++tjGHJkTT4lVHwCLfo2uywz7lGWZ0KTX9kTsTvgvs9cOn1568Qc7U50XieNv2XNGy NdMOJtvHAPe2YaKEIh64jBwFDtpqSyw1OXkeexsLlLNJzukNalH8NIEqRAKfAY0Nl+bR JtYGFM0RoqAqvfCq4y9iArYzJK1DLJbryihJxmwCxPky4RxMcdb0NffedNy8z3xGCp0x JprQ== X-Gm-Message-State: AGi0PuYFv6A53V2flDb64SPREwxFKWsNbeQ5b+nzdMoAgLSS0ez1rHaL MKY5uvxqRlOz7qHso8csLi/+MhPn X-Google-Smtp-Source: APiQypJI07Mxea/Un6qnNGKeAqvst+331zueBYLP+BJJ5zZRFAdjrm2anrdQvvDxr8R7MWoY70R5fQ== X-Received: by 2002:ad4:4e4d:: with SMTP id eb13mr24927138qvb.169.1588046737427; Mon, 27 Apr 2020 21:05:37 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 03/21] libxl: fix qemu-trad cmdline for no sdl/vnc case Date: Tue, 28 Apr 2020 00:04:15 -0400 Message-Id: <20200428040433.23504-4-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Jason Andryuk , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Anthony PERARD , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki When qemu is running in stubdomain, any attempt to initialize vnc/sdl there will crash it (on failed attempt to load a keymap from a file). If vfb is present, all those cases are skipped. But since b053f0c4c9e533f3d97837cf897eb920b8355ed3 "libxl: do not start dom0 qemu for stubdomain when not needed" it is possible to create a stubdomain without vfb and contrary to the comment -vnc none do trigger VNC initialization code (just skips exposing it externally). Change the implicit SDL avoiding method to -nographics option, used when none of SDL or VNC is enabled. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Acked-by: Ian Jackson Acked-by: Wei Liu Signed-off-by: Jason Andryuk --- Changes in v2: - typo in qemu option Changes in v3: - add missing { } --- tools/libxl/libxl_dm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index f4007bbe50..b91e63db6f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -734,14 +734,15 @@ static int libxl__build_device_model_args_old(libxl__= gc *gc, if (libxl_defbool_val(vnc->findunused)) { flexarray_append(dm_args, "-vncunused"); } - } else + } else if (!sdl) { /* * VNC is not enabled by default by qemu-xen-traditional, - * however passing -vnc none causes SDL to not be - * (unexpectedly) enabled by default. This is overridden by - * explicitly passing -sdl below as required. + * however skipping -vnc causes SDL to be + * (unexpectedly) enabled by default. If undesired, disable graphi= cs at + * all. */ - flexarray_append_pair(dm_args, "-vnc", "none"); + flexarray_append(dm_args, "-nographic"); + } =20 if (sdl) { flexarray_append(dm_args, "-sdl"); --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046760; cv=none; d=zohomail.com; s=zohoarc; b=dYWqzPvHI648FK2aTspsh7RwLz4J06HV/fuB60V32XAxZKfi8NRsV+lTDhb1oejmSQ+s6wLT4gAoWk+8Tdl/NyzVyukxhAmD1I23xhbsYRtWwlmBlrmvawHVguRRZdPFlo6D/1Tn6SWeFq+hPx3Ainld7f+PjIKnjxArTvMSun0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046760; 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=Ddex++nzv2WYh9FC7KtYSgOC1YbK2YwKv0Rii0LLw7o=; b=GFuWgHiMsIKRGiQTbvCkv7u9luOyzRLuN4/N6bd6NbgAyf9nHSZ5asW8PK8DKIFVpLwZbLHclkBnTT/8VBn7U7kaYqDB+41SwEVijA5SsE4p6nXGgWbNtYzf9PQryRPk2h/hIwD9G3B+RtfudZhUUqzHWhWv1RjU0pwW1EITNq8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046760258723.8406802718565; Mon, 27 Apr 2020 21:06:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVD-0000Qf-5i; Tue, 28 Apr 2020 04:05:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVC-0000QF-1R for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:46 +0000 Received: from mail-qt1-x844.google.com (unknown [2607:f8b0:4864:20::844]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 86acac3c-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:05:41 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id 71so16251205qtc.12 for ; Mon, 27 Apr 2020 21:05:41 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:39 -0700 (PDT) X-Inumbo-ID: 86acac3c-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ddex++nzv2WYh9FC7KtYSgOC1YbK2YwKv0Rii0LLw7o=; b=ov+oNqKtDHx8DQ6zzoPSKXyhC8TM3EG+VH40bPsL9hNcHFe9tfYq4VzQbVz4Os602K 4I2dA1/0OJH0Z9RUNYpIz8EVGWZfhVWLiNCEhV7ja7rfnWNCxGyb8HoXRebyYxv4GN+h HILcBRI9M2qpn04fhGk+Z0qbf5gMq2FbmlsytmE6XicGBsO1cIX30q9PMW/obElBHCnQ im5n36eDkzV031uhYZo/oaaaM5APjF40WbWHTTwpwaZhuppvq0BQRZCaw7SblfYjoh+o ju+oI28j6Z5Y3TkG6GclxGHu74lFY/1bRsKCHxaFKTyj4fRrLjEZdkRgNQEl3WlSH3v2 DyHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ddex++nzv2WYh9FC7KtYSgOC1YbK2YwKv0Rii0LLw7o=; b=c4Vsrm9EulKiGKHEvmDjsRzAQmZSORP3s4jI8cNI0PNoJG539non9wutFA3Stkqo2P Y8t7IGq+iFR4wLLQmwT2pWqqTLqZfjuMu5c7xYnFPO/r9wFNROWpAPzyuhBprkrPafJH N105JwTrfGsUtKB9HbY8Xz1lhwZPeLSCS8r4WGI2jVQ1o63Ax5TeGgpd45dpLnW71g1B DbqOZJicgpmNglueLNCFZ2lxHHabAuG7fwNHBWJaFOZ6pZjmezl0OfzRyRLztLuUlzZB g16U5P1LC6KXFRkf3aAh49Fdf/8192qMarz3Y8utG6zYFAJxKmHmchqSC0/1NvaDzEUS /wQA== X-Gm-Message-State: AGi0PuaRuQXKeFKRUuQauXTI1w08rFFIdHbyHYyvRWLGexi1aQ+z2yt8 85Jdq+XrJmOjpnr0GnmffdALcPfa X-Google-Smtp-Source: APiQypK2jyLGMQGUp4b+E6gCVFV9GE91aXQSlv5XtU2jGUZO+IfaXAVglrJHHI50rqkvZlcfV547Fg== X-Received: by 2002:ac8:33fd:: with SMTP id d58mr24272862qtb.213.1588046740924; Mon, 27 Apr 2020 21:05:40 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 04/21] libxl: Allow running qemu-xen in stubdomain Date: Tue, 28 Apr 2020 00:04:16 -0400 Message-Id: <20200428040433.23504-5-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Do not prohibit anymore using stubdomain with qemu-xen. To help distingushing MiniOS and Linux stubdomain, add helper inline functions libxl__stubdomain_is_linux() and libxl__stubdomain_is_linux_running(). Those should be used where really the difference is about MiniOS/Linux, not qemu-xen/qemu-xen-traditional. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- Changes in v3: - new patch, instead of "libxl: Add "stubdomain_version" to domain_build_info" - helper functions as suggested by Ian Jackson --- tools/libxl/libxl_create.c | 9 --------- tools/libxl/libxl_internal.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index e7cb2dbc2b..7423ee8e57 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -171,15 +171,6 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, } } =20 - if (b_info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM && - b_info->device_model_version !=3D - LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL && - libxl_defbool_val(b_info->device_model_stubdomain)) { - LOG(ERROR, - "device model stubdomains require \"qemu-xen-traditional\""); - return ERROR_INVAL; - } - if (!b_info->max_vcpus) b_info->max_vcpus =3D 1; if (!b_info->avail_vcpus.size) { diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 5f39e44cb9..ebbf926897 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2320,6 +2320,23 @@ _hidden int libxl__device_model_version_running(libx= l__gc *gc, uint32_t domid); /* Return the system-wide default device model */ _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *= gc); =20 +static inline +bool libxl__stubdomain_is_linux_running(libxl__gc *gc, uint32_t domid) +{ + /* same logic as in libxl__stubdomain_is_linux */ + return libxl__device_model_version_running(gc, domid) + =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; +} + +static inline +bool libxl__stubdomain_is_linux(libxl_domain_build_info *b_info) +{ + /* right now qemu-tranditional implies MiniOS stubdomain and qemu-xen + * implies Linux stubdomain */ + return libxl_defbool_val(b_info->device_model_stubdomain) && + b_info->device_model_version =3D=3D LIBXL_DEVICE_MODEL_VERSION_QEM= U_XEN; +} + #define DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, fmt, _a...) = \ libxl__sprintf(gc, "/local/domain/%u/device-model/%u" fmt, dm_domid, = \ domid, ##_a) --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046768; cv=none; d=zohomail.com; s=zohoarc; b=UqURLgb6KNYJSbltwcvKWiRZYrjr3qQr9y+rUGB/aVu3S6NrwwGXybjCxfe4eRrt7PW6JrdBU2UpB0BuILxz6YFqmp1jlMF/6HClc5u55X8pheJmUnQeLa+1inkAyb9gvmuP+szLLUGjaBQn9qiIFgxKUIV3KGMVseAMbdc41i0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046768; 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=4ZHa799QMBrK+LH740solrl4J2E+hLWHdCeWlcMTowY=; b=YZ16qYbaH9tYz0Jca8Apn8X7NyRW33Ifky00reMHqTJLwWCw8EROz3qbN0/uqoPTIszssxBR+n459UhOihmGAj4aubmTn5l1i+/6DOWi4u+bO5CeDdy0SN0s0S4bWVK5kkFBMTbSdjxlvsFoHeReO8Tc4KN/ih7x2+aeMKJBt6Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046768915630.6383483971896; Mon, 27 Apr 2020 21:06:08 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVI-0000Sn-EZ; Tue, 28 Apr 2020 04:05:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVH-0000SD-1K for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:51 +0000 Received: from mail-qk1-x742.google.com (unknown [2607:f8b0:4864:20::742]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 89bbd01a-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:05:46 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id h124so3365584qke.11 for ; Mon, 27 Apr 2020 21:05:46 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:44 -0700 (PDT) X-Inumbo-ID: 89bbd01a-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4ZHa799QMBrK+LH740solrl4J2E+hLWHdCeWlcMTowY=; b=pGbobHFmvz0cl/Kn4uXU40BhrUeZBRnbPh4NyVZSC0ERdgcfSQShYB9ae1lcsW1kpR v87BSGIIWwYP3CAK/fPuo2tofFL9arLZXDWXVXmbAWj06z3MPsuqtBa6kb4wxCxwRqOp fcyIyKXl4jifo7b0pFkY1nwuHDJ/04f2y8KBb4i0mF1UpjEYiXJWzEfHXrvBEJqPMJbH clI90W8EG5yxcdCxABiy6a3ZljMZY/j6HtZpvblU+kVf7WCRMeQeCt7fX5qlsZ6v9WVv kvToUQBihglpQb1ShDbTQLt+wuwCU2/QhnqDuBlSMbM0COiP5KX5Fzr5CoFtbLuEunx7 jZMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4ZHa799QMBrK+LH740solrl4J2E+hLWHdCeWlcMTowY=; b=MGdba816Lp2t64JQLLMBGd1qr5FZGVm6ShAyHkGziYcY1WoxF7Bv6AonCr6cQI9u7F ES+X5GzSZeVMzZq6Uz9XyiIcvCk1eILA57nVmkAO/xuwFtU/GD4ijUbIqgC8kSIRAhSG 3s4qpmiad3ybfvzJi6pShYY90R4qdreWmxz6cfgjyh4p71dN8BbVCax7vdyaha2BnFG7 rDNUKQEBJ6Xl2Q/J3M32EaScWCubigcRnbTyXQMi7TVsrvORUTHCsxIyV4vRnAVpOaPc S4kHaGjsD5QpbSuvfnFVF3seFtBF4b3LO6W1GqhQwbcG8uwSjK4l/FcLWSY5wCAgSkpY IDCw== X-Gm-Message-State: AGi0PuYxumrWI09BML4XAj4y4F7O+Vn50hbiTt6/LBLc1jj/6Afe4Okf WdsLb3DmZnwNw2mXlzZFl7Sxs25k X-Google-Smtp-Source: APiQypK8hBSDJawGiQcW2x0qN4Gz1UkjtRjYpUNAZaKRxT6Xw6Y8nL+dPMV+ldsp933HJaYVL5CtrQ== X-Received: by 2002:a37:b58:: with SMTP id 85mr2554988qkl.353.1588046745597; Mon, 27 Apr 2020 21:05:45 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 05/21] libxl: Handle Linux stubdomain specific QEMU options. Date: Tue, 28 Apr 2020 00:04:17 -0400 Message-Id: <20200428040433.23504-6-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Jason Andryuk , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Simon Gaiser , Anthony PERARD , Ian Jackson , Eric Shelton Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Eric Shelton This patch creates an appropriate command line for the QEMU instance running in a Linux-based stubdomain. NOTE: a number of items are not currently implemented for Linux-based stubdomains, such as: - save/restore - QMP socket - graphics output (e.g., VNC) Signed-off-by: Eric Shelton Simon: * fix disk path * fix cdrom path and "format" Signed-off-by: Simon Gaiser [drop Qubes-specific parts] Signed-off-by: Marek Marczykowski-G=C3=B3recki Allow setting stubdomain_ramdisk independently from stubdomain_kernel Add a qemu- prefix for qemu-stubdom-linux-{kernel,rootfs} since stubdom doesn't convey device-model. Use qemu- since this code is qemu specific. Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- Changes in v2: - fix serial specified with serial=3D[ ... ] syntax - error out on multiple consoles (incompatible with stubdom) - drop erroneous chunk about cdrom Changes in v3: - change to use libxl__stubdomain_is_linux instead of b_info->stubdomain_version - drop libxl__stubdomain_version_running, prefer libxl__stubdomain_is_linux_running introduced by previous patch - drop ifup/ifdown script - stubdomain will handle that with qemu events itself - slightly simplify -serial argument - add support for multiple serial consoles, do not ignore b_info.u.serial(_list) - add error checking for more than 26 emulated disks ("/dev/xvd%c" format string) Changes in v5: - commit message fixup to match patch contents - Marek - file names are now qemu-stubdom-linux-{kernel,rootfs} - Jason - allow setting ramdisk independently of kernel - Jason --- tools/libxl/libxl_create.c | 45 +++++++++ tools/libxl/libxl_dm.c | 190 ++++++++++++++++++++++++----------- tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_mem.c | 6 +- tools/libxl/libxl_types.idl | 3 + 5 files changed, 184 insertions(+), 61 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 7423ee8e57..3b5535f2c8 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -171,6 +171,40 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, } } =20 + if (b_info->type =3D=3D LIBXL_DOMAIN_TYPE_HVM && + libxl_defbool_val(b_info->device_model_stubdomain)) { + if (!b_info->stubdomain_kernel) { + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + b_info->stubdomain_kernel =3D + libxl__abs_path(NOGC, "ioemu-stubdom.gz", libxl__x= enfirmwaredir_path()); + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + b_info->stubdomain_kernel =3D + libxl__abs_path(NOGC, + "qemu-stubdom-linux-kernel", + libxl__xenfirmwaredir_path()); + break; + default: + abort(); + } + } + if (!b_info->stubdomain_ramdisk) { + switch (b_info->device_model_version) { + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: + break; + case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: + b_info->stubdomain_ramdisk =3D + libxl__abs_path(NOGC, + "qemu-stubdom-linux-rootfs", + libxl__xenfirmwaredir_path()); + break; + default: + abort(); + } + } + } + if (!b_info->max_vcpus) b_info->max_vcpus =3D 1; if (!b_info->avail_vcpus.size) { @@ -206,6 +240,17 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, if (b_info->target_memkb =3D=3D LIBXL_MEMKB_DEFAULT) b_info->target_memkb =3D b_info->max_memkb; =20 + if (b_info->stubdomain_memkb =3D=3D LIBXL_MEMKB_DEFAULT) { + if (libxl_defbool_val(b_info->device_model_stubdomain)) { + if (libxl__stubdomain_is_linux(b_info)) + b_info->stubdomain_memkb =3D LIBXL_LINUX_STUBDOM_MEM * 102= 4; + else + b_info->stubdomain_memkb =3D 28 * 1024; // MiniOS + } else { + b_info->stubdomain_memkb =3D 0; // no stubdomain + } + } + libxl_defbool_setdefault(&b_info->claim_mode, false); =20 libxl_defbool_setdefault(&b_info->localtime, false); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index b91e63db6f..5a7d55686f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1188,6 +1188,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, int i, connection, devid; uint64_t ram_size; const char *path, *chardev; + bool is_stubdom =3D libxl_defbool_val(b_info->device_model_stubdomain); =20 dm_args =3D flexarray_make(gc, 16, 1); dm_envs =3D flexarray_make(gc, 16, 1); @@ -1197,39 +1198,42 @@ static int libxl__build_device_model_args_new(libxl= __gc *gc, flexarray_vappend(dm_args, dm, "-xen-domid", GCSPRINTF("%d", guest_domid), NULL); + flexarray_append(dm_args, "-no-shutdown"); =20 - flexarray_append(dm_args, "-chardev"); - if (state->dm_monitor_fd >=3D 0) { - flexarray_append(dm_args, - GCSPRINTF("socket,id=3Dlibxl-cmd,fd=3D%d,server,nowait", - state->dm_monitor_fd)); + /* There is currently no way to access the QMP socket in the stubdom */ + if (!is_stubdom) { + flexarray_append(dm_args, "-chardev"); + if (state->dm_monitor_fd >=3D 0) { + flexarray_append(dm_args, + GCSPRINTF("socket,id=3Dlibxl-cmd,fd=3D%d,server,nowait", + state->dm_monitor_fd)); =20 - /* - * Start QEMU with its "CPU" paused, it will not start any emulati= on - * until the QMP command "cont" is used. This also prevent QEMU fr= om - * writing "running" to the "state" xenstore node so we only use t= his - * flag when we have the QMP based startup notification. - * */ - flexarray_append(dm_args, "-S"); - } else { - flexarray_append(dm_args, - GCSPRINTF("socket,id=3Dlibxl-cmd," - "path=3D%s,server,nowait", - libxl__qemu_qmp_path(gc, guest_domid))); - } + /* + * Start QEMU with its "CPU" paused, it will not start any emu= lation + * until the QMP command "cont" is used. This also prevent QEM= U from + * writing "running" to the "state" xenstore node so we only u= se this + * flag when we have the QMP based startup notification. + * */ + flexarray_append(dm_args, "-S"); + } else { + flexarray_append(dm_args, + GCSPRINTF("socket,id=3Dlibxl-cmd," + "path=3D%s,server,nowait", + libxl__qemu_qmp_path(gc, guest_domi= d))); + } =20 - flexarray_append(dm_args, "-no-shutdown"); - flexarray_append(dm_args, "-mon"); - flexarray_append(dm_args, "chardev=3Dlibxl-cmd,mode=3Dcontrol"); + flexarray_append(dm_args, "-mon"); + flexarray_append(dm_args, "chardev=3Dlibxl-cmd,mode=3Dcontrol"); =20 - flexarray_append(dm_args, "-chardev"); - flexarray_append(dm_args, - GCSPRINTF("socket,id=3Dlibxenstat-cmd," - "path=3D%s/qmp-libxenstat-%d,server,no= wait", - libxl__run_dir_path(), guest_domid)); + flexarray_append(dm_args, "-chardev"); + flexarray_append(dm_args, + GCSPRINTF("socket,id=3Dlibxenstat-cmd," + "path=3D%s/qmp-libxenstat-%d,serve= r,nowait", + libxl__run_dir_path(), guest_domid= )); =20 - flexarray_append(dm_args, "-mon"); - flexarray_append(dm_args, "chardev=3Dlibxenstat-cmd,mode=3Dcontrol"); + flexarray_append(dm_args, "-mon"); + flexarray_append(dm_args, "chardev=3Dlibxenstat-cmd,mode=3Dcontrol= "); + } =20 for (i =3D 0; i < guest_config->num_channels; i++) { connection =3D guest_config->channels[i].connection; @@ -1273,7 +1277,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, flexarray_vappend(dm_args, "-name", c_info->name, NULL); } =20 - if (vnc) { + if (vnc && !is_stubdom) { char *vncarg =3D NULL; =20 flexarray_append(dm_args, "-vnc"); @@ -1312,7 +1316,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, } =20 flexarray_append(dm_args, vncarg); - } else + } else if (!is_stubdom) /* * Ensure that by default no vnc server is created. */ @@ -1324,7 +1328,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, */ flexarray_append_pair(dm_args, "-display", "none"); =20 - if (sdl) { + if (sdl && !is_stubdom) { flexarray_append(dm_args, "-sdl"); if (sdl->display) flexarray_append_pair(dm_envs, "DISPLAY", sdl->display); @@ -1366,18 +1370,34 @@ static int libxl__build_device_model_args_new(libxl= __gc *gc, { LOGD(ERROR, guest_domid, "Both serial and serial_list set"= ); return ERROR_INVAL; - } - if (b_info->u.hvm.serial) { - flexarray_vappend(dm_args, - "-serial", b_info->u.hvm.serial, NULL); - } else if (b_info->u.hvm.serial_list) { - char **p; - for (p =3D b_info->u.hvm.serial_list; - *p; - p++) { - flexarray_vappend(dm_args, - "-serial", - *p, NULL); + } else { + if (b_info->u.hvm.serial) { + if (is_stubdom) { + /* see spawn_stub_launch_dm() for connecting STUBD= OM_CONSOLE_SERIAL */ + flexarray_vappend(dm_args, + "-serial", + GCSPRINTF("/dev/hvc%d", STUBDOM_= CONSOLE_SERIAL), + NULL); + } else { + flexarray_vappend(dm_args, + "-serial", b_info->u.hvm.serial,= NULL); + } + } else if (b_info->u.hvm.serial_list) { + char **p; + /* see spawn_stub_launch_dm() for connecting STUBDOM_C= ONSOLE_SERIAL */ + for (p =3D b_info->u.hvm.serial_list, i =3D 0; + *p; + p++, i++) { + if (is_stubdom) + flexarray_vappend(dm_args, + "-serial", + GCSPRINTF("/dev/hvc%d", STUB= DOM_CONSOLE_SERIAL + i), + NULL); + else + flexarray_vappend(dm_args, + "-serial", + *p, NULL); + } } } } @@ -1386,7 +1406,7 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, flexarray_append(dm_args, "-nographic"); } =20 - if (libxl_defbool_val(b_info->u.hvm.spice.enable)) { + if (libxl_defbool_val(b_info->u.hvm.spice.enable) && !is_stubdom) { const libxl_spice_info *spice =3D &b_info->u.hvm.spice; char *spiceoptions =3D dm_spice_options(gc, spice); if (!spiceoptions) @@ -1813,7 +1833,9 @@ static int libxl__build_device_model_args_new(libxl__= gc *gc, * If qemu isn't doing the interpreting, the parameter is * always raw */ - if (disks[i].backend =3D=3D LIBXL_DISK_BACKEND_QDISK) + if (libxl_defbool_val(b_info->device_model_stubdomain)) + format =3D "host_device"; + else if (disks[i].backend =3D=3D LIBXL_DISK_BACKEND_QDISK) format =3D libxl__qemu_disk_format_string(disks[i].format); else format =3D libxl__qemu_disk_format_string(LIBXL_DISK_FORMA= T_RAW); @@ -1824,6 +1846,16 @@ static int libxl__build_device_model_args_new(libxl_= _gc *gc, disks[i].vdev); continue; } + } else if (libxl_defbool_val(b_info->device_model_stubdomain))= { + if (disk > 'z' - 'a') { + LOGD(WARN, guest_domid, + "Emulation of only first %d disks is supported= with qemu-xen in stubdomain.\n" + "Disk %d will be available via PV drivers but = not as an emulated disk.", + 'z' - 'a', + disk); + continue; + } + target_path =3D GCSPRINTF("/dev/xvd%c", 'a' + disk); } else { if (format =3D=3D NULL) { LOGD(WARN, guest_domid, @@ -1964,7 +1996,7 @@ static int libxl__build_device_model_args(libxl__gc *= gc, char ***args, char ***envs, const libxl__domain_build_state *s= tate, int *dm_state_fd) -/* dm_state_fd may be NULL iff caller knows we are using old stubdom +/* dm_state_fd may be NULL iff caller knows we are using stubdom * and therefore will be passing a filename rather than a fd. */ { switch (guest_config->b_info.device_model_version) { @@ -1974,8 +2006,10 @@ static int libxl__build_device_model_args(libxl__gc = *gc, args, envs, state); case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN: - assert(dm_state_fd !=3D NULL); - assert(*dm_state_fd < 0); + if (!libxl_defbool_val(guest_config->b_info.device_model_stubdomai= n)) { + assert(dm_state_fd !=3D NULL); + assert(*dm_state_fd < 0); + } return libxl__build_device_model_args_new(gc, dm, guest_domid, guest_confi= g, args, envs, @@ -2080,6 +2114,16 @@ retry_transaction: return 0; } =20 +static int libxl__store_libxl_entry(libxl__gc *gc, uint32_t domid, + const char *name, const char *value) +{ + char *path =3D NULL; + + path =3D libxl__xs_libxl_path(gc, domid); + path =3D libxl__sprintf(gc, "%s/%s", path, name); + return libxl__xs_printf(gc, XBT_NULL, path, "%s", value); +} + static void dmss_init(libxl__dm_spawn_state *dmss) { libxl__ev_qmp_init(&dmss->qmp); @@ -2138,10 +2182,14 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__s= tub_dm_spawn_state *sdss) dmss_init(&sdss->pvqemu); libxl__xswait_init(&sdss->xswait); =20 - if (guest_config->b_info.device_model_version !=3D - LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) { - ret =3D ERROR_INVAL; - goto out; + assert(libxl_defbool_val(guest_config->b_info.device_model_stubdomain)= ); + + if (libxl__stubdomain_is_linux(&guest_config->b_info)) { + if (d_state->saved_state) { + LOG(ERROR, "Save/Restore not supported yet with Linux Stubdom.= "); + ret =3D -1; + goto out; + } } =20 sdss->pvqemu.guest_domid =3D INVALID_DOMID; @@ -2163,8 +2211,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stu= b_dm_spawn_state *sdss) =20 dm_config->b_info.shadow_memkb =3D 0; dm_config->b_info.max_vcpus =3D 1; - dm_config->b_info.max_memkb =3D 28 * 1024 + - guest_config->b_info.video_memkb; + dm_config->b_info.max_memkb =3D guest_config->b_info.stubdomain_memkb; + dm_config->b_info.max_memkb +=3D guest_config->b_info.video_memkb; dm_config->b_info.target_memkb =3D dm_config->b_info.max_memkb; =20 dm_config->b_info.max_grant_frames =3D guest_config->b_info.max_grant_= frames; @@ -2203,10 +2251,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) dm_config->num_vkbs =3D 1; } =20 - stubdom_state->pv_kernel.path - =3D libxl__abs_path(gc, "ioemu-stubdom.gz", libxl__xenfirmwaredir_= path()); - stubdom_state->pv_cmdline =3D GCSPRINTF(" -d %d", guest_domid); - stubdom_state->pv_ramdisk.path =3D ""; + stubdom_state->pv_kernel.path =3D guest_config->b_info.stubdomain_kern= el; + stubdom_state->pv_ramdisk.path =3D guest_config->b_info.stubdomain_ram= disk; =20 /* fixme: this function can leak the stubdom if it fails */ ret =3D libxl__domain_make(gc, dm_config, stubdom_state, @@ -2226,6 +2272,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stu= b_dm_spawn_state *sdss) goto out; } =20 + libxl__store_libxl_entry(gc, guest_domid, "dm-version", + libxl_device_model_version_to_string(dm_config->b_info.device_mode= l_version)); libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args); libxl__xs_printf(gc, XBT_NULL, GCSPRINTF("%s/image/device-model-domid", @@ -2235,6 +2283,15 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) GCSPRINTF("%s/target", libxl__xs_get_dompath(gc, dm_domid)), "%d", guest_domid); + if (guest_config->b_info.device_model_version =3D=3D LIBXL_DEVICE_MODE= L_VERSION_QEMU_XEN) { + /* qemu-xen is used as a dm in the stubdomain, so we set the bios + * accroding to this */ + libxl__xs_printf(gc, XBT_NULL, + libxl__sprintf(gc, "%s/hvmloader/bios", + libxl__xs_get_dompath(gc, guest_dom= id)), + "%s", + libxl_bios_type_to_string(guest_config->b_info.u.h= vm.bios)); + } ret =3D xc_domain_set_target(ctx->xch, dm_domid, guest_domid); if (ret<0) { LOGED(ERROR, guest_domid, "setting target domain %d -> %d", @@ -2316,6 +2373,11 @@ static void spawn_stub_launch_dm(libxl__egc *egc, =20 if (guest_config->b_info.u.hvm.serial) num_console++; + else if (guest_config->b_info.u.hvm.serial_list) { + char **serial =3D guest_config->b_info.u.hvm.serial_list; + while (*(serial++)) + num_console++; + } =20 console =3D libxl__calloc(gc, num_console, sizeof(libxl__device_consol= e)); =20 @@ -2349,8 +2411,18 @@ static void spawn_stub_launch_dm(libxl__egc *egc, console[i].output =3D GCSPRINTF("pipe:%s", d_state->saved_state); break; + case STUBDOM_CONSOLE_SERIAL: + if (guest_config->b_info.u.hvm.serial) { + console[i].output =3D guest_config->b_info.u.hvm.seria= l; + break; + } + /* fall-through */ default: - console[i].output =3D "pty"; + /* Serial_list is set, as otherwise num_consoles would be + * smaller and consoles 0-2 are handled above. */ + assert(guest_config->b_info.u.hvm.serial_list); + console[i].output =3D guest_config->b_info.u.hvm.serial_li= st[ + i-STUBDOM_CONSOLE_SERIAL]; break; } } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index ebbf926897..a8f0eed945 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -119,6 +119,7 @@ #define STUBDOM_CONSOLE_RESTORE 2 #define STUBDOM_CONSOLE_SERIAL 3 #define STUBDOM_SPECIAL_CONSOLES 3 +#define LIBXL_LINUX_STUBDOM_MEM 128 #define TAP_DEVICE_SUFFIX "-emu" #define DOMID_XS_PATH "domid" #define PVSHIM_BASENAME "xen-shim" diff --git a/tools/libxl/libxl_mem.c b/tools/libxl/libxl_mem.c index bc7b95aa74..e52a9624ea 100644 --- a/tools/libxl/libxl_mem.c +++ b/tools/libxl/libxl_mem.c @@ -459,8 +459,10 @@ int libxl__domain_need_memory_calculate(libxl__gc *gc, case LIBXL_DOMAIN_TYPE_PVH: case LIBXL_DOMAIN_TYPE_HVM: *need_memkb +=3D LIBXL_HVM_EXTRA_MEMORY; - if (libxl_defbool_val(b_info->device_model_stubdomain)) - *need_memkb +=3D 32 * 1024; + if (libxl_defbool_val(b_info->device_model_stubdomain)) { + *need_memkb +=3D b_info->stubdomain_memkb; + *need_memkb +=3D b_info->video_memkb; + } break; case LIBXL_DOMAIN_TYPE_PV: *need_memkb +=3D LIBXL_PV_EXTRA_MEMORY; diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index f7c473be74..9d3f05f399 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -518,6 +518,9 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ =20 ("device_model_version", libxl_device_model_version), ("device_model_stubdomain", libxl_defbool), + ("stubdomain_memkb", MemKB), + ("stubdomain_kernel", string), + ("stubdomain_ramdisk", string), # if you set device_model you must set device_model_version too ("device_model", string), ("device_model_ssidref", uint32), --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046772; cv=none; d=zohomail.com; s=zohoarc; b=IIn65dFIXbvojrsJiASja1jMIh/R7M9HbcDWr+I7BgDhNI5iSXQHogggmVONhlDN3ZZ/e6Mfhfj7Hg9WJKuuAd381tVS6C4ruXzjABW7zV3UsH0wd41YKQJCRjq4fhYOowM+A8X0MYdTXhty9CXh7Q+qZ8vAFvM1bOYzIvmlveI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046772; 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=Yoxvi6Fn0hUGtZXkSZVhDlRzjiYf6QAuf1u1v/s9kVg=; b=nEulkohjxkEYCmzjx6PFoFwI/DXqCKMhrI8Eh8N8NN5hcn61QbETK/Nlfyog67b0NHhVQ9E77XXP1tq63VSP5YO1mwRvyooCHnqw7vocT9Tx/W0sxJd6jgQ1VUjUcMsIdENAtS54582KH64+Rg2irFhbERWjkWEVa124DLqJ43o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046772741308.89794773694814; Mon, 27 Apr 2020 21:06:12 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVM-0000Vl-Sg; Tue, 28 Apr 2020 04:05:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVM-0000VL-1W for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:05:56 +0000 Received: from mail-qk1-x741.google.com (unknown [2607:f8b0:4864:20::741]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8b13d8fe-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:05:49 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id o135so8118574qke.6 for ; Mon, 27 Apr 2020 21:05:48 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:47 -0700 (PDT) X-Inumbo-ID: 8b13d8fe-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yoxvi6Fn0hUGtZXkSZVhDlRzjiYf6QAuf1u1v/s9kVg=; b=nyhTvCVteicwBRfml1F/1X9SEKlXDcf0mV1eQmWK1EqABYdVryIuvIWhhsMnu5K8of 64/qp10xpdfNjGbCJcC6a/ZI0NNTRp/HpMHeDJSA5yWtbxof6Sf4Kj4XIQVpwLp9Xjli cM1Gi+DnVw7F46KsqUWwf85COaMdI8069FpwngO4fqJeU+qCSFJcL+Pmn6r62xRAjQqs YFDZ11NJviyEcUU5DT/tjhWei5q5aecQViZxokdThfy9tWrMOWwZ7Kspgf51XIyKpMWX tnp2PAMeJygPKGOo394xbhwcy4PNrRH06cN9toIFuKguFiPYAwP3Fk5726zETIIH92nM OAig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yoxvi6Fn0hUGtZXkSZVhDlRzjiYf6QAuf1u1v/s9kVg=; b=YClyXe6Zo0d5pmPf5CdWeciYWELbBrw+DyEc0lk/dJyS6FAYdetAtkSQUk9KcSX1U1 8G9jyi5f51vIoPAJYEf+y+9z8Suz6Rfu7XqGhagKsScEYWSkkhVq1WhNN2EGvJ4T3rKa mGkjtat0igr98ZfnNg5/xFtldWvFl92T/WI5dNLCAuik08jps2rSRf1Ywwu5JnrDHSIL cbQq5d7JA0eivxOBF0SonCIb1Pw11SvFWAfba2xCYK6CrzKP6CprTUtFV7NenboYps4l 8UpMDYkjmxOFmKvPqC1tOOE/jz46ZjkK4zRPut4mb+swknJ7rPHYdvqR09+9aSF1aqGW VkbA== X-Gm-Message-State: AGi0PuZrHIehQLGkfA2K1s+/QzwDPEMHoAZ5KSWBYV/vFR3CVM92M/iU SQvpQgVe4GGu6dOae3RBncVi4NcN X-Google-Smtp-Source: APiQypLZoo0Q1RhuT991ZsJO2xnFOfB8H+6LeffSoO1ivN3ZzIMZHQ8XBInLAOiRw0Wm6TYx5CCiFw== X-Received: by 2002:a37:6594:: with SMTP id z142mr25445572qkb.55.1588046748320; Mon, 27 Apr 2020 21:05:48 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 06/21] libxl: write qemu arguments into separate xenstore keys Date: Tue, 28 Apr 2020 00:04:18 -0400 Message-Id: <20200428040433.23504-7-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki This allows using arguments with spaces, like -append, without nominating any special "separator" character. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk --- Changes in v3: - previous version of this patch "libxl: use \x1b to separate qemu arguments for linux stubdomain" used specific non-printable separator, but it was rejected as xenstore doesn't cope well with non-printable chars --- tools/libxl/libxl_dm.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 5a7d55686f..bdc23554eb 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2065,6 +2065,40 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(= libxl__gc *gc, return 0; } =20 +static int libxl__write_stub_linux_dmargs(libxl__gc *gc, + int dm_domid, int guest_domid, + char **args) +{ + libxl_ctx *ctx =3D libxl__gc_owner(gc); + int i; + char *vm_path; + char *path; + struct xs_permissions roperm[2]; + xs_transaction_t t; + + roperm[0].id =3D 0; + roperm[0].perms =3D XS_PERM_NONE; + roperm[1].id =3D dm_domid; + roperm[1].perms =3D XS_PERM_READ; + + vm_path =3D libxl__xs_read(gc, XBT_NULL, GCSPRINTF("/local/domain/%d/v= m", guest_domid)); + path =3D GCSPRINTF("%s/image/dmargs", vm_path); + +retry_transaction: + t =3D xs_transaction_start(ctx->xsh); + xs_write(ctx->xsh, t, path, "", 0); + xs_set_permissions(ctx->xsh, t, path, roperm, ARRAY_SIZE(roperm)); + i =3D 1; + for (i=3D1; args[i] !=3D NULL; i++) + xs_write(ctx->xsh, t, GCSPRINTF("%s/%03d", path, i), args[i], strl= en(args[i])); + + xs_set_permissions(ctx->xsh, t, GCSPRINTF("%s/rtc/timeoffset", vm_path= ), roperm, ARRAY_SIZE(roperm)); + if (!xs_transaction_end(ctx->xsh, t, 0)) + if (errno =3D=3D EAGAIN) + goto retry_transaction; + return 0; +} + static int libxl__write_stub_dmargs(libxl__gc *gc, int dm_domid, int guest_domid, char **args) @@ -2274,7 +2308,10 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) =20 libxl__store_libxl_entry(gc, guest_domid, "dm-version", libxl_device_model_version_to_string(dm_config->b_info.device_mode= l_version)); - libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args); + if (libxl__stubdomain_is_linux(&guest_config->b_info)) + libxl__write_stub_linux_dmargs(gc, dm_domid, guest_domid, args); + else + libxl__write_stub_dmargs(gc, dm_domid, guest_domid, args); libxl__xs_printf(gc, XBT_NULL, GCSPRINTF("%s/image/device-model-domid", libxl__xs_get_dompath(gc, guest_domid)), --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046777; cv=none; d=zohomail.com; s=zohoarc; b=EFpI7KcEOIgatF0sqwyn5d6iYi+2VVdGfdzmQ/WkEA7dhAp1uS+Qy96Ogj6VfqwgYjb5jOudwzZ+FM+W2LKDeGfO3XKgHfcBpUdWjJYdsEmTGIoK7tdG31yCdBrLzqAVwYBfui1Yoxqci2uKjwF5g7A95HaEbS3oSWJZ8F6JpgA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046777; 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=ScCYPQwHljuvh1NyG9qLCW4etudB53sNPzGGuSEsg5E=; b=ZhHGfTHnlJw7xwM33vu5+CwJS/fiCX7TtQatkN+4Qfy9NZmWoJtixKOCypXmXBQmkIdpjxa8IJKiTnJl1y74Vtw6p8KJ8HSgi+h9GypLwRzF3763VZgrblk/tJ84u4nbU+LWkwhxyilUOE0BQn2d6qsN8ERqhGr+yKjGoVDinPI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046777888847.8442684948809; Mon, 27 Apr 2020 21:06:17 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVS-0000Yo-5r; Tue, 28 Apr 2020 04:06:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVR-0000Y3-1j for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:01 +0000 Received: from mail-qk1-x741.google.com (unknown [2607:f8b0:4864:20::741]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8ce4326e-8905-11ea-9887-bc764e2007e4; Tue, 28 Apr 2020 04:05:52 +0000 (UTC) Received: by mail-qk1-x741.google.com with SMTP id l78so20535005qke.7 for ; Mon, 27 Apr 2020 21:05:52 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:50 -0700 (PDT) X-Inumbo-ID: 8ce4326e-8905-11ea-9887-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ScCYPQwHljuvh1NyG9qLCW4etudB53sNPzGGuSEsg5E=; b=DD8dKbE2UyuORRV4e6/jwNd1KZZCUDLQzDSt56sCVNhtvNq/JNdETGi9a0zmgy+4v6 51xv70N0uBsYFjgyxXLnoSwdN0Dm3W6YJwojBumX6l2lcWloZhYl8jDe5U/ym3oiAM/o V+aSGC3FrQnDdJPjs4MhwJekCGUqZk7oRQbPZXRpAKoYMQouUAqmGXaPZqv3pmcvdAC9 gYayFUrcN2KjqpbCSVGS3xtqxjvIj/RI6M5IY/N+WmVvrirRdi1XB+lpF2EDqUTR8ahc yaitGp2AqxkbzD80sDStZcO5iWFnzTglhehiY1FbpdhW6Pd1xk+BkAoBtc3Xyy7NQbeI 1IQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ScCYPQwHljuvh1NyG9qLCW4etudB53sNPzGGuSEsg5E=; b=V7DWXszAsAfWJ9jGYmzRvowVMFjFgIMk/djDKAJkzO7aZ6tyT5v8BZJkrHhP0BcZDw 1fmEHS3fVLDyrMf9RRfMXe8VWlkR02OnPT+3K3/DK91ezyg1xvrE/wKRiXpclvDjkXTj OkDRJDh42/EowSW1l7rc5jG3bT3WFZPQP+JO46T/Ro/r4bXNU3IHtI17LZOlFt2PhpV/ 21Rp5oH8rtEeY9JJug1lL6AypCo101O0V6K2GYlgcbddnmy8gc5pUg2a/Uemo/wCMHMb Ph70qUJXTy2l8sfHIXnyck655GAE5go++1UCMxA17V4p1RDFzDKZURzNhScVp/DiToyn xOLA== X-Gm-Message-State: AGi0Pua53Sqk1urZyBWdcYC474RkTryTMJZe8kYIqiuP/+ogw/+YOeFo u1dYxS5neatVxgGFBkHn91EdufnE X-Google-Smtp-Source: APiQypLQj+SpdbcefmCI0JV61LJufloBhRsV9i3XEZ3SYaTXit5sr4pE9fwesQz6rYAUnf+MDR7hVw== X-Received: by 2002:a37:d93:: with SMTP id 141mr26036151qkn.32.1588046751337; Mon, 27 Apr 2020 21:05:51 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 07/21] xl: add stubdomain related options to xl config parser Date: Tue, 28 Apr 2020 00:04:19 -0400 Message-Id: <20200428040433.23504-8-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- docs/man/xl.cfg.5.pod.in | 27 +++++++++++++++++++++++---- tools/xl/xl_parse.c | 7 +++++++ 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 0e9e58a41a..c9bc181a95 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2733,10 +2733,29 @@ model which they were installed with. =20 =3Ditem B =20 -Override the path to the binary to be used as the device-model. The -binary provided here MUST be consistent with the -B which you have specified. You should not -normally need to specify this option. +Override the path to the binary to be used as the device-model running in +toolstack domain. The binary provided here MUST be consistent with the +B which you have specified. You should not normally = need +to specify this option. + +=3Ditem B + +Override the path to the kernel image used as device-model stubdomain. +The binary provided here MUST be consistent with the +B which you have specified. +In case of B it is expected to be MiniOS-based stubd= omain +image, in case of B it is expected to be Linux-based stubdomain +kernel. + +=3Ditem B + +Override the path to the ramdisk image used as device-model stubdomain. +The binary provided here is to be used by a kernel pointed by B. +It is known to be used only by Linux-based stubdomain kernel. + +=3Ditem B + +Start the stubdomain with MBYTES megabytes of RAM. Default is 128. =20 =3Ditem B =20 diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 4450d59f16..61b4ef7b7e 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2525,6 +2525,13 @@ skip_usbdev: xlu_cfg_replace_string(config, "device_model_user", &b_info->device_model_user, 0); =20 + xlu_cfg_replace_string (config, "stubdomain_kernel", + &b_info->stubdomain_kernel, 0); + xlu_cfg_replace_string (config, "stubdomain_ramdisk", + &b_info->stubdomain_ramdisk, 0); + if (!xlu_cfg_get_long (config, "stubdomain_memory", &l, 0)) + b_info->stubdomain_memkb =3D l * 1024; + #define parse_extra_args(type) \ e =3D xlu_cfg_get_list_as_string_list(config, "device_model_args"#type= , \ &b_info->extra##type, 0); \ --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046780; cv=none; d=zohomail.com; s=zohoarc; b=j8Tn+C1wKOBlrxZU28h2z0YOURTL2GqKeBrY+DslDtIy64z5MU7gk97SKoryFgJRR3zA6QnQfaKAhT2exo5H+DCrTMCrR7mQv9+hJbnLc97n4eT6y92sQZSkHZzYgix3Wx4vJPJ4q0tMUzceL32dF828b+1lQIuETZ8TdJHurH4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046780; 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=Cw7c/W+2mWKsQFqee8I2XqBHCRi5cVGdl4h/Cw+zkCI=; b=IeepvgYWErjg1TfMoy6uwZWphcDqWeCpMwKIpUOY6JsDFbKuQYWhQHQsRYgd5pYVbIzJiZjX7Z+f8sFJrY2B6vXa/nckhc2HtHBCM7h6hoTkkFVgYPmjvsPkXBQzvphdbIKS3YqUOIMkeEC37KYmvy5UDACRS4KamMyDaPWkBzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046780143260.9503294940133; Mon, 27 Apr 2020 21:06:20 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVX-0000cR-Gb; Tue, 28 Apr 2020 04:06:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVW-0000bQ-1q for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:06 +0000 Received: from mail-qt1-x844.google.com (unknown [2607:f8b0:4864:20::844]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 8f39d6e0-8905-11ea-9887-bc764e2007e4; Tue, 28 Apr 2020 04:05:55 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id e17so12875241qtp.7 for ; Mon, 27 Apr 2020 21:05:55 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:54 -0700 (PDT) X-Inumbo-ID: 8f39d6e0-8905-11ea-9887-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Cw7c/W+2mWKsQFqee8I2XqBHCRi5cVGdl4h/Cw+zkCI=; b=deeKyblR46LgGqs9LOHt2LrBIUW7UhBvbPlNksDocNlNzNQXfU0IRiWcxIj4fzHDvq +ZnbUyKwrkSubIidY3mhQDZ7mYKBnwLDbllr1DULYmbPtMCDo4mY07K2NFekai+aq1W0 DuNJPDKdvX3hGjbdZSQ5ThdLfj5jsgmJb12UCM7+FTU8KxoeJYdSlHVzN+5+MmmJUWTE +PHzKolEnL61VD9ofKDuF3nJpdlHSD9oG4378SrNombZBkv8nn181IGhqHdS38Cqdr5N 1cB52mtMUP4/+P/hO0ZwmiLsd5QdJB8ivXvVD877DJUYBr5KI3GVTe4csXLB0gWdRTn6 F+Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cw7c/W+2mWKsQFqee8I2XqBHCRi5cVGdl4h/Cw+zkCI=; b=FJdY94niJoIiLt54dQeyOVAIoWGwSoKwrTBEHMABJh8sjivSNeI6GLHJFLquf4BZbu Auof7MJnuPDNmshiNrJg1E1fFMYNwwVf8vxqJzHFytfnoUz53goDVFb9k9tOvPIvkUbu HTs093ilWoayBzwv0r8r519otfM3sA9DLj4O7qrYk0cKDwQC4z6Rj2svOM3UxLG+6G/w Mvf0NvfD668pmzhQ5njazHTMUilXEojaKmzXJhxEOt2IFodG0tpL1t6F0mqkdbl3PimG N4PXJ0gcxSSu1be5YSOXG9A3tbQpcnEft7WzNl6JdRLhJeJLiELnhM3gp0lZL0cWv59e x+iA== X-Gm-Message-State: AGi0PuZWkCkkAk/cgYatK25CUBviJhi1HLmRboPQVzUtihoCToCkMkmz ngufZnZcpkJkTO8X+eSZh+/++vnd X-Google-Smtp-Source: APiQypJehUmb9f9TUjkaI9CqrTXfXqqf+UmnSUDU0BrdPRFrcHyxJvAdCWseTeNJ8YwjyqRJyeHMug== X-Received: by 2002:ac8:4757:: with SMTP id k23mr26167284qtp.206.1588046755362; Mon, 27 Apr 2020 21:05:55 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 08/21] tools/libvchan: notify server when client is connected Date: Tue, 28 Apr 2020 00:04:20 -0400 Message-Id: <20200428040433.23504-9-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Let the server know when the client is connected. Otherwise server will notice only when client send some data. This change does not break existing clients, as libvchan user should handle spurious notifications anyway (for example acknowledge of remote side reading the data). Signed-off-by: Marek Marczykowski-G=C3=B3recki Replace spaces with tabs to match the file's whitespace. Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- Marek: I had this patch in Qubes for a long time and totally forgot it wasn't upstream thing... --- tools/libvchan/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/libvchan/init.c b/tools/libvchan/init.c index 180833dc2f..ad4b64fbe3 100644 --- a/tools/libvchan/init.c +++ b/tools/libvchan/init.c @@ -447,6 +447,9 @@ struct libxenvchan *libxenvchan_client_init(struct xent= oollog_logger *logger, ctrl->ring->cli_live =3D 1; ctrl->ring->srv_notify =3D VCHAN_NOTIFY_WRITE; =20 + /* wake up the server */ + xenevtchn_notify(ctrl->event, ctrl->event_port); + out: if (xs) xs_daemon_close(xs); --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046791; cv=none; d=zohomail.com; s=zohoarc; b=neQX8/XwR7P5FEhOF7DMKM2J3mdkFHeUTN4KJAgE1dyAa3cGvna6+cBlqgVuD+y7t0M98CDsY28U6flJOGf9WdHhGb7fS8XhgeYVvtcyZL48jjvBNymtMlV1kOtfmp8ogFJEdxT9wSwnVJSbKcEGPY+vSXtflryCnvLv+OJ4mTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046791; 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=qv1Q9DnV7+kaRXi7fO8SZeqk2BXV8QqwlY5OCm77OCE=; b=Eq5ibiK/Iz9+SO03i0b0DXQZ42wx2rQUBl5jFlZs7BkcMvmiODp6JIxjTewwCiRG/QsBqKwdrjk3NibZ4APLVeixrxNHB/BcptPuycgRCr26Uy7nnnCcCy7+hH0XdCdFAFqODG3KBefD8XR48YCR/n0O5oFvaMg4Kc7frEEYDBg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046791646701.293474807835; Mon, 27 Apr 2020 21:06:31 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVb-0000fi-QU; Tue, 28 Apr 2020 04:06:11 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVb-0000fA-1x for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:11 +0000 Received: from mail-qt1-x844.google.com (unknown [2607:f8b0:4864:20::844]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 913a2be8-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:05:59 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id 71so16251513qtc.12 for ; Mon, 27 Apr 2020 21:05:59 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:05:57 -0700 (PDT) X-Inumbo-ID: 913a2be8-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qv1Q9DnV7+kaRXi7fO8SZeqk2BXV8QqwlY5OCm77OCE=; b=L4eAre5KFeI+b0nlRSuCm1sXm4alzuHrtT3B0Zeyr1sS1JAWrnwaQkU4+PXdx/h6ZA BiR6WDA7iQX+M9iZ+zmaz4IGNTCCpIIz4cYNzx/5sIDbnaYHzKr3Qsc5aI7wh68WyN72 y98te83uayOpg3jKH1nqTfnYV6HOrHmWPez7jQr8U4mqVkrCtbfM8nobljR/FK7Fpr9V nGQTRbit091mV3Bm+OGokCvMoqGjkL2PaaJF99dWa9qF1nyAKNtapYUS2DX7B8MJmC9M MfsQf+gWb8hMh8PFMn7gN8smG0KLt+WwOYWTs3MF2hM16w6Ivdu3nZXSpp/mBSAy5CLR oDsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qv1Q9DnV7+kaRXi7fO8SZeqk2BXV8QqwlY5OCm77OCE=; b=YGp8vaDP9D2BDhcCbyclr3PlifvQz/h5tpqvVzQv4fZlUqh9Hgy1pvs1rW6st5nuUq d52DFGSIDU0mtMfwN1T9XQA4RsmfzpPnK99byhQ/Sy4oZ2o9aZ6OoY6veqsK2gR1E6zi Ho5k2mg24et/gTLz4xHOjvszTtyk9UIgwSkEfSaENoeA1+eUE0jTUfwFwZjwjMWloug2 F8hqkIIHJPUSlzFglsg9zYJLBsaFdP8/n7Y7RoqpcMSdZYaLPHSDVLQ1FqPEU10A8sio foImfmgVAolyDYkEX1O7vQoJbyGAn0EfXKB8qaLhFw59OnLcNlKCjo7qYD+ewa/hJAPE JUuw== X-Gm-Message-State: AGi0PubOUnfcVdQgDB1PonECXz1Ge6vv/QsASPVGqhVXWM/KAfreoZU6 deLnTSyXHik2ZySEKfPTWY7tL8iH X-Google-Smtp-Source: APiQypKQwAKlZIZvCmo9Y3whpXQpmhBwZR7/XpW/aL14R/yGGmP1n+QQPTCC3GBNPRQJFnzcvzvkYQ== X-Received: by 2002:ac8:4a06:: with SMTP id x6mr27416022qtq.163.1588046758653; Mon, 27 Apr 2020 21:05:58 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 09/21] libxl: add save/restore support for qemu-xen in stubdomain Date: Tue, 28 Apr 2020 00:04:21 -0400 Message-Id: <20200428040433.23504-10-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Rely on a wrapper script in stubdomain to attach FD 3/4 of qemu to relevant consoles. Signed-off-by: Marek Marczykowski-G=C3=B3recki Address TODO in dm_state_save_to_fdset: Only remove savefile for non-stubdom. Signed-off-by: Jason Andryuk --- Changes in v3: - adjust for qmp_ev* - assume specific fdset id in qemu set in stubdomain Changes in v5: - Only remove savefile for non-stubdom --- tools/libxl/libxl_dm.c | 23 +++++++++++------------ tools/libxl/libxl_qmp.c | 27 +++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index bdc23554eb..45d0dd56f5 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1744,10 +1744,17 @@ static int libxl__build_device_model_args_new(libxl= __gc *gc, } =20 if (state->saved_state) { - /* This file descriptor is meant to be used by QEMU */ - *dm_state_fd =3D open(state->saved_state, O_RDONLY); - flexarray_append(dm_args, "-incoming"); - flexarray_append(dm_args, GCSPRINTF("fd:%d",*dm_state_fd)); + if (is_stubdom) { + /* Linux stubdomain connects specific FD to STUBDOM_CONSOLE_RE= STORE + */ + flexarray_append(dm_args, "-incoming"); + flexarray_append(dm_args, "fd:3"); + } else { + /* This file descriptor is meant to be used by QEMU */ + *dm_state_fd =3D open(state->saved_state, O_RDONLY); + flexarray_append(dm_args, "-incoming"); + flexarray_append(dm_args, GCSPRINTF("fd:%d",*dm_state_fd)); + } } for (i =3D 0; b_info->extra && b_info->extra[i] !=3D NULL; i++) flexarray_append(dm_args, b_info->extra[i]); @@ -2218,14 +2225,6 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) =20 assert(libxl_defbool_val(guest_config->b_info.device_model_stubdomain)= ); =20 - if (libxl__stubdomain_is_linux(&guest_config->b_info)) { - if (d_state->saved_state) { - LOG(ERROR, "Save/Restore not supported yet with Linux Stubdom.= "); - ret =3D -1; - goto out; - } - } - sdss->pvqemu.guest_domid =3D INVALID_DOMID; =20 libxl_domain_create_info_init(&dm_config->c_info); diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index efaba91086..c394000ea9 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -962,6 +962,7 @@ static void dm_stopped(libxl__egc *egc, libxl__ev_qmp *= ev, const libxl__json_object *response, int rc); static void dm_state_fd_ready(libxl__egc *egc, libxl__ev_qmp *ev, const libxl__json_object *response, int rc); +static void dm_state_save_to_fdset(libxl__egc *egc, libxl__ev_qmp *ev, int= fdset); static void dm_state_saved(libxl__egc *egc, libxl__ev_qmp *ev, const libxl__json_object *response, int rc); =20 @@ -994,10 +995,17 @@ static void dm_stopped(libxl__egc *egc, libxl__ev_qmp= *ev, EGC_GC; libxl__domain_suspend_state *dsps =3D CONTAINER_OF(ev, *dsps, qmp); const char *const filename =3D dsps->dm_savefile; + uint32_t dm_domid =3D libxl_get_stubdom_id(CTX, dsps->domid); =20 if (rc) goto error; =20 + if (dm_domid) { + /* see Linux stubdom interface in docs/stubdom.txt */ + dm_state_save_to_fdset(egc, ev, 1); + return; + } + ev->payload_fd =3D open(filename, O_WRONLY | O_CREAT, 0600); if (ev->payload_fd < 0) { LOGED(ERROR, ev->domid, @@ -1028,7 +1036,6 @@ static void dm_state_fd_ready(libxl__egc *egc, libxl_= _ev_qmp *ev, EGC_GC; int fdset; const libxl__json_object *o; - libxl__json_object *args =3D NULL; libxl__domain_suspend_state *dsps =3D CONTAINER_OF(ev, *dsps, qmp); =20 close(ev->payload_fd); @@ -1043,6 +1050,21 @@ static void dm_state_fd_ready(libxl__egc *egc, libxl= __ev_qmp *ev, goto error; } fdset =3D libxl__json_object_get_integer(o); + dm_state_save_to_fdset(egc, ev, fdset); + return; + +error: + assert(rc); + libxl__remove_file(gc, dsps->dm_savefile); + dsps->callback_device_model_done(egc, dsps, rc); +} + +static void dm_state_save_to_fdset(libxl__egc *egc, libxl__ev_qmp *ev, int= fdset) +{ + EGC_GC; + int rc; + libxl__json_object *args =3D NULL; + libxl__domain_suspend_state *dsps =3D CONTAINER_OF(ev, *dsps, qmp); =20 ev->callback =3D dm_state_saved; =20 @@ -1060,7 +1082,8 @@ static void dm_state_fd_ready(libxl__egc *egc, libxl_= _ev_qmp *ev, =20 error: assert(rc); - libxl__remove_file(gc, dsps->dm_savefile); + if (!libxl_get_stubdom_id(CTX, dsps->domid)) + libxl__remove_file(gc, dsps->dm_savefile); dsps->callback_device_model_done(egc, dsps, rc); } =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046793; cv=none; d=zohomail.com; s=zohoarc; b=isU6Fuby9++f97vcTAhqtw3/MkjrtHvbLt3giSaElYyKY72+OfGmBxnwXH34Gtt4MfrpzoC6xuGLF3yZbAKqfuyFKrkOqvHLfR+mOiYf4VuDR9kBQqUK9dTGysPczvplxD3FVdJ8sD3QNygH3ZKE7uPMbkBVMVfV2Map+SHtD1w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046793; 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=Arrq//I+mnu3nWRhCeF/WBnbP/Hq+npxYP1a8HiQr4M=; b=cf/bFEPsARjdovTLTB5wI2bhxBNFS3yngoTe2+lD0C1vXR3jLpYd3w/AUEkDnhx2VC0hKVlYtqrmua4D+sMMnCYsWgp/aP/PaqqRaNDtDVTks3236ZB8i8GQumz2I+jv1sfdSF1nZXt0nX5AWVQRDF9SVy6FtX0sKkxwHoTXVBs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046793789711.1406639461674; Mon, 27 Apr 2020 21:06:33 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVh-0000jX-3o; Tue, 28 Apr 2020 04:06:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVg-0000it-1v for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:16 +0000 Received: from mail-qv1-xf41.google.com (unknown [2607:f8b0:4864:20::f41]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 92d151c0-8905-11ea-ae69-bc764e2007e4; Tue, 28 Apr 2020 04:06:01 +0000 (UTC) Received: by mail-qv1-xf41.google.com with SMTP id v38so9754348qvf.6 for ; Mon, 27 Apr 2020 21:06:01 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:00 -0700 (PDT) X-Inumbo-ID: 92d151c0-8905-11ea-ae69-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Arrq//I+mnu3nWRhCeF/WBnbP/Hq+npxYP1a8HiQr4M=; b=hZfZ4crkIQkgZ0ilyZj7UayWCfCwD+E4gTg95iTtvNGHVCXBpP6JO+EKbfFAtbur5/ XMrybm1+PWaWtIxOHwg9ezkODI7gtMF+TRNy8bsmHT+5fOxh0Z0WbGbVLUnjUbWsUg0X on3C8KGJlx3lJvEEJGeqIg9nZptVUuQ1gqM6kHFBOeDXexsHcffQQ5lseJF3DZnot1nx PwDAxQyDm2bHa4n5OeUgI3eTvGIsiAO4HMGMzPO4TFsDmq0vsVmLDFEmUQe8EEPA+qrT FXYnrF1Y5Ers0Vm4oLNZck/PgVHoN/hGxQ50IXLmRrFxtyxeRSs8hyuV5zZKN1GAbsJL ffrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Arrq//I+mnu3nWRhCeF/WBnbP/Hq+npxYP1a8HiQr4M=; b=YS36gTsCkhzUJPT900QzpDX3jxC5geWVUSLaljhTQac2Sv/HBzdsAc+xff+4oXxBIg cD1angYxLzn95GzAOdzrtez8239dnQnLX8srek786iuiUKPSDuPWZIM3ASddYFtJBgTZ OK9cYKP8Vuy0+oPGOxdsiaT/P+1iafZWdCKo0Ytq2qPzfkc+xaj52VvLS1NW2BSC0Ref Etm3YUifqnlb2pwaqv/4wYfwo6WCHUeMRJR3hIhwgfhdRBEvI+QI/bLSJSIXlct7SgIp /k0KHInXEJ3gGI88ECmlA9o4r3ZmEZOSTaqPw11x53nCqsHDDlRel+dRrBz8tfFpZxUT iGTg== X-Gm-Message-State: AGi0PuanxHEss2z2iuai4v0F2sMLSxBgV/voNRUy6aKxUM1EYkI9e3o7 UqmM00eBta5ns/OziRAB6ZBYiuva X-Google-Smtp-Source: APiQypJSQIX/p45NGmrU9FSEZUsYzvUfUxsQE748u+PA4e1GlPc+Pgs202mVFF7tbxjemvGsvyfuHA== X-Received: by 2002:a0c:dd8c:: with SMTP id v12mr25165846qvk.134.1588046761385; Mon, 27 Apr 2020 21:06:01 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 10/21] tools: add missing libxenvchan cflags Date: Tue, 28 Apr 2020 00:04:22 -0400 Message-Id: <20200428040433.23504-11-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki libxenvchan.h include xenevtchn.h and xengnttab.h, so applications built with it needs applicable -I in CFLAGS too. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- tools/Rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Rules.mk b/tools/Rules.mk index 9bac15c8d1..078eb7230a 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -159,7 +159,7 @@ SHDEPS_libxenstat =3D $(SHLIB_libxenctrl) $(SHLIB_libx= enstore) LDLIBS_libxenstat =3D $(SHDEPS_libxenstat) $(XEN_LIBXENSTAT)/libxenstat$(= libextension) SHLIB_libxenstat =3D $(SHDEPS_libxenstat) -Wl,-rpath-link=3D$(XEN_LIBXEN= STAT) =20 -CFLAGS_libxenvchan =3D -I$(XEN_LIBVCHAN) +CFLAGS_libxenvchan =3D -I$(XEN_LIBVCHAN) $(CFLAGS_libxengnttab) $(CFLAGS_l= ibxenevtchn) SHDEPS_libxenvchan =3D $(SHLIB_libxentoollog) $(SHLIB_libxenstore) $(SHLIB= _libxenevtchn) $(SHLIB_libxengnttab) LDLIBS_libxenvchan =3D $(SHDEPS_libxenvchan) $(XEN_LIBVCHAN)/libxenvchan$(= libextension) SHLIB_libxenvchan =3D $(SHDEPS_libxenvchan) -Wl,-rpath-link=3D$(XEN_LIBVC= HAN) --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046802; cv=none; d=zohomail.com; s=zohoarc; b=BHk/390KRtOxPrbDLsBUsF0Go/k+jS3yNfGHT5ex3EocJYoiKjI3cnF2n/OLL/i2YrpLw88hMTSBtT9byJQTME0Vg/MXNL18TA31PfeLWcEY6VyPd/mXweLhWbb46jOAA1qYFJ51GxLPi16fXPZqU4NMVggxzJwNs/eZTUkcNfo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046802; 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=igivI7+/HwMdigsHAPp76Z5QjR1GMgCyDtDB+aqMExI=; b=Mq1I8HW4U9g2FDEKskGJIT9E5Wwrkm2yGsCtxjyNg4A3oYNGdM8s4TYpsDlWdcB97mWlydFUBAlzmkF/CrOXiIdzyX0vqNwqrZPo/icOhAXi0r3BvYTPWciQIfV0mNoFz/Ij8VV9wws7vzC8VESjI6C0iZR/iDa8JnONVWB5/YI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046802481375.6630193300216; Mon, 27 Apr 2020 21:06:42 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVm-0000nh-ID; Tue, 28 Apr 2020 04:06:22 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVl-0000mk-27 for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:21 +0000 Received: from mail-qk1-x733.google.com (unknown [2607:f8b0:4864:20::733]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 94dd3b14-8905-11ea-b07b-bc764e2007e4; Tue, 28 Apr 2020 04:06:05 +0000 (UTC) Received: by mail-qk1-x733.google.com with SMTP id b188so18961187qkd.9 for ; Mon, 27 Apr 2020 21:06:05 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:03 -0700 (PDT) X-Inumbo-ID: 94dd3b14-8905-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=igivI7+/HwMdigsHAPp76Z5QjR1GMgCyDtDB+aqMExI=; b=MV4b/bL97n6Tw0fTgrGdew4XotX04c6cNTbmA3PDXUiz4F8i8YjGA3iz0FsWmncQRF ybkDZYgm9yAg0k8Rsj6ii1ple/mhuVHKl2PBmt4Wo98QwfTGSqhr9/A9dJ9YrZVq/8lQ aKIs6NqBwV7+pZ61xsQrQ73IyVkBMrMdSyjDGTLsHpwM47QdU+PHR9XO+EnemLOrVcor 2FT03F4VmL0Y/ajNw4W0f++S07ye3K/QZnj67FnaUQ/0kD8A8egNhaIIY/0uP9ryxjpQ HyxvjM7pb3dVeIjd66GKN2iyXHBNpO/zRpUri649Q87BbbFRe7iqvxVLDFOIRhGebEsU EYug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=igivI7+/HwMdigsHAPp76Z5QjR1GMgCyDtDB+aqMExI=; b=D8Rw6h1voS1F6WkN4ng13dFUfpix8tKfbdOnjgFyflYfq/ztxfBBuNv0BGWD+KPJty mIfBNHgRxBr9V/s9qY8lq0ep9hyP4Y9YgQ7XaO8DSQ3UfEAVOwOxebuVtoz+I/Vy1gXh tNFN09hXBIZKEsJgIi9MXSFCrlnDbi0CH83XbPwYG5lM26ExDh4hV3GQWslV/Mf7bJF+ 5JFR3msZJoUVy/UJwhUt6OrzcU2x4v+aH994kJVY+Ane3qr0N0VIBVS/37Yiw64X/SQD M6LqxeiRI2jhifqLadLAmYxcjUbPYsrsEcm7jgrtyAlBpFzorcQ9XHb1H7+Ng/tlAPnH uCbg== X-Gm-Message-State: AGi0PuYtNXflx30szWF3gwTeR/Ic9JvHxDB7UM+HK+GPEHKsAzG4MCfG 1UnBC534L/+qksc0w4u1aPpjVm9s X-Google-Smtp-Source: APiQypKShq5B1JtltMTsAwXjnv+Qf0joWoZY07FvVc1+vt02pbOidyBwVrQ2DFfz4231atGTEYqCSQ== X-Received: by 2002:a37:690:: with SMTP id 138mr26032733qkg.414.1588046764271; Mon, 27 Apr 2020 21:06:04 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 11/21] tools: add simple vchan-socket-proxy Date: Tue, 28 Apr 2020 00:04:23 -0400 Message-Id: <20200428040433.23504-12-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Add a simple proxy for tunneling socket connection over vchan. This is based on existing vchan-node* applications, but extended with socket support. vchan-socket-proxy serves both as a client and as a server, depending on parameters. It can be used to transparently communicate with an application in another domian that normally expose UNIX socket interface. Specifically, it's written to communicate with qemu running within stubdom. Server mode listens for vchan connections and when one is opened, connects to a pointed UNIX socket. Client mode listens on UNIX socket and when someone connects, opens a vchan connection. Only a single connection at a time is supported. Additionally, socket can be provided as a number - in which case it's interpreted as already open FD (in case of UNIX listening socket - listen() needs to be already called). Or "-" meaning stdin/stdout - in which case it is reduced to vchan-node2 functionality. Example usage: 1. (in dom0) vchan-socket-proxy --mode=3Dclient /local/domain//data/vchan/1234 /run/qemu.(DOMID) 2. (in DOMID) vchan-socket-proxy --mode=3Dserver 0 /local/domain//data/vchan/1234 /run/qemu.(DOMID) This will listen on /run/qemu.(DOMID) in dom0 and whenever connection is made, it will connect to DOMID, where server process will connect to /run/qemu.(DOMID) there. When client disconnects, vchan connection is terminated and server vchan-socket-proxy process also disconnects from qemu. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- Changes on v5: - Ensure bindir directory is present - String and comment fixes --- .gitignore | 1 + tools/libvchan/Makefile | 8 +- tools/libvchan/vchan-socket-proxy.c | 478 ++++++++++++++++++++++++++++ 3 files changed, 486 insertions(+), 1 deletion(-) create mode 100644 tools/libvchan/vchan-socket-proxy.c diff --git a/.gitignore b/.gitignore index 4ca679ddbc..1760e54464 100644 --- a/.gitignore +++ b/.gitignore @@ -368,6 +368,7 @@ tools/misc/xenwatchdogd tools/misc/xen-hvmcrash tools/misc/xen-lowmemd tools/libvchan/vchan-node[12] +tools/libvchan/vchan-socket-proxy tools/ocaml/*/.ocamldep.make tools/ocaml/*/*.cm[ixao] tools/ocaml/*/*.cmxa diff --git a/tools/libvchan/Makefile b/tools/libvchan/Makefile index 7892750c3e..913bcc8884 100644 --- a/tools/libvchan/Makefile +++ b/tools/libvchan/Makefile @@ -13,6 +13,7 @@ LIBVCHAN_PIC_OBJS =3D $(patsubst %.o,%.opic,$(LIBVCHAN_OB= JS)) LIBVCHAN_LIBS =3D $(LDLIBS_libxenstore) $(LDLIBS_libxengnttab) $(LDLIBS_li= bxenevtchn) $(LIBVCHAN_OBJS) $(LIBVCHAN_PIC_OBJS): CFLAGS +=3D $(CFLAGS_libxenstore) $= (CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn) $(NODE_OBJS) $(NODE2_OBJS): CFLAGS +=3D $(CFLAGS_libxengnttab) $(CFLAGS_li= bxenevtchn) +vchan-socket-proxy.o: CFLAGS +=3D $(CFLAGS_libxenstore) $(CFLAGS_libxenctr= l) $(CFLAGS_libxengnttab) $(CFLAGS_libxenevtchn) =20 MAJOR =3D 4.14 MINOR =3D 0 @@ -39,7 +40,7 @@ $(PKG_CONFIG_LOCAL): PKG_CONFIG_LIBDIR =3D $(CURDIR) $(PKG_CONFIG_LOCAL): PKG_CONFIG_CFLAGS_LOCAL =3D $(CFLAGS_xeninclude) =20 .PHONY: all -all: libxenvchan.so vchan-node1 vchan-node2 libxenvchan.a $(PKG_CONFIG_INS= T) $(PKG_CONFIG_LOCAL) +all: libxenvchan.so vchan-node1 vchan-node2 vchan-socket-proxy libxenvchan= .a $(PKG_CONFIG_INST) $(PKG_CONFIG_LOCAL) =20 libxenvchan.so: libxenvchan.so.$(MAJOR) ln -sf $< $@ @@ -59,13 +60,18 @@ vchan-node1: $(NODE_OBJS) libxenvchan.so vchan-node2: $(NODE2_OBJS) libxenvchan.so $(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLA= GS) =20 +vchan-socket-proxy: vchan-socket-proxy.o libxenvchan.so + $(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenvchan) $(LDLIBS_libxenstore) $(L= DLIBS_libxenctrl) $(APPEND_LDFLAGS) + .PHONY: install install: all $(INSTALL_DIR) $(DESTDIR)$(libdir) $(INSTALL_DIR) $(DESTDIR)$(includedir) + $(INSTALL_DIR) $(DESTDIR)$(bindir) $(INSTALL_PROG) libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) ln -sf libxenvchan.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/libxenvchan.s= o.$(MAJOR) ln -sf libxenvchan.so.$(MAJOR) $(DESTDIR)$(libdir)/libxenvchan.so + $(INSTALL_PROG) vchan-socket-proxy $(DESTDIR)$(bindir) $(INSTALL_DATA) libxenvchan.h $(DESTDIR)$(includedir) $(INSTALL_DATA) libxenvchan.a $(DESTDIR)$(libdir) $(INSTALL_DATA) xenvchan.pc $(DESTDIR)$(PKG_INSTALLDIR) diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-soc= ket-proxy.c new file mode 100644 index 0000000000..13700c5d67 --- /dev/null +++ b/tools/libvchan/vchan-socket-proxy.c @@ -0,0 +1,478 @@ +/** + * @file + * @section AUTHORS + * + * Copyright (C) 2010 Rafal Wojtczuk + * + * Authors: + * Rafal Wojtczuk + * Daniel De Graaf + * Marek Marczykowski-G=C3=B3recki + * + * @section LICENSE + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; If not, see . + * + * @section DESCRIPTION + * + * This is a vchan to unix socket proxy. Vchan server is set, and on client + * connection, local socket connection is established. Communication is bi= directional. + * One client is served at a time, clients needs to coordinate this themse= lves. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void usage(char** argv) +{ + fprintf(stderr, "usage:\n" + "\t%s [options] domainid nodepath [socket-path|file-no|-]\n" + "\n" + "options:\n" + "\t-m, --mode=3Dclient|server - vchan connection mode (client by d= efault)\n" + "\t-s, --state-path=3Dpath - xenstore path where write \"running\"= to \n" + "\t at startup\n" + "\t-v, --verbose - verbose logging\n" + "\n" + "client: client of a vchan connection, fourth parameter can be:\n" + "\tsocket-path: listen on a UNIX socket at this path and connect t= o vchan\n" + "\t whenever new connection is accepted;\n" + "\t handle multiple _subsequent_ connections, until te= rminated\n" + "\n" + "\tfile-no: except open FD of a socket in listen mode;\n" + "\t otherwise similar to socket-path\n" + "\n" + "\t-: open vchan connection immediately and pass the dat= a\n" + "\t from stdin/stdout; terminate when vchan connection= \n" + "\t is closed\n" + "\n" + "server: server of a vchan connection, fourth parameter can be:\n" + "\tsocket-path: connect to this UNIX socket when new vchan connect= ion\n" + "\t is accepted;\n" + "\t handle multiple _subsequent_ connections, until te= rminated\n" + "\n" + "\tfile-no: pass data to/from this FD; terminate when vchan co= nnection\n" + "\t is closed\n" + "\n" + "\t-: pass data to/from stdin/stdout; terminate when vch= an\n" + "\t connection is closed\n", + argv[0]); + exit(1); +} + +#define BUFSIZE 8192 +char inbuf[BUFSIZE]; +char outbuf[BUFSIZE]; +int insiz =3D 0; +int outsiz =3D 0; +int verbose =3D 0; + +static void vchan_wr(struct libxenvchan *ctrl) { + int ret; + + if (!insiz) + return; + ret =3D libxenvchan_write(ctrl, inbuf, insiz); + if (ret < 0) { + fprintf(stderr, "vchan write failed\n"); + exit(1); + } + if (verbose) + fprintf(stderr, "wrote %d bytes to vchan\n", ret); + if (ret > 0) { + insiz -=3D ret; + memmove(inbuf, inbuf + ret, insiz); + } +} + +static void socket_wr(int output_fd) { + int ret; + + if (!outsiz) + return; + ret =3D write(output_fd, outbuf, outsiz); + if (ret < 0 && errno !=3D EAGAIN) + exit(1); + if (ret > 0) { + outsiz -=3D ret; + memmove(outbuf, outbuf + ret, outsiz); + } +} + +static int set_nonblocking(int fd, int nonblocking) { + int flags =3D fcntl(fd, F_GETFL); + if (flags =3D=3D -1) + return -1; + + if (nonblocking) + flags |=3D O_NONBLOCK; + else + flags &=3D ~O_NONBLOCK; + + if (fcntl(fd, F_SETFL, flags) =3D=3D -1) + return -1; + + return 0; +} + +static int connect_socket(const char *path_or_fd) { + int fd; + char *endptr; + struct sockaddr_un addr; + + fd =3D strtoll(path_or_fd, &endptr, 0); + if (*endptr =3D=3D '\0') { + set_nonblocking(fd, 1); + return fd; + } + + fd =3D socket(AF_UNIX, SOCK_STREAM, 0); + if (fd =3D=3D -1) + return -1; + + addr.sun_family =3D AF_UNIX; + strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path)); + if (connect(fd, (const struct sockaddr *)&addr, sizeof(addr)) =3D=3D -= 1) { + close(fd); + return -1; + } + + set_nonblocking(fd, 1); + + return fd; +} + +static int listen_socket(const char *path_or_fd) { + int fd; + char *endptr; + struct sockaddr_un addr; + + fd =3D strtoll(path_or_fd, &endptr, 0); + if (*endptr =3D=3D '\0') { + return fd; + } + + /* if not a number, assume a socket path */ + fd =3D socket(AF_UNIX, SOCK_STREAM, 0); + if (fd =3D=3D -1) + return -1; + + addr.sun_family =3D AF_UNIX; + strncpy(addr.sun_path, path_or_fd, sizeof(addr.sun_path)); + if (bind(fd, (const struct sockaddr *)&addr, sizeof(addr)) =3D=3D -1) { + close(fd); + return -1; + } + if (listen(fd, 5) !=3D 0) { + close(fd); + return -1; + } + + return fd; +} + +static struct libxenvchan *connect_vchan(int domid, const char *path) { + struct libxenvchan *ctrl =3D NULL; + struct xs_handle *xs =3D NULL; + xc_interface *xc =3D NULL; + xc_dominfo_t dominfo; + char **watch_ret; + unsigned int watch_num; + int ret; + + xs =3D xs_open(XS_OPEN_READONLY); + if (!xs) { + perror("xs_open"); + goto out; + } + xc =3D xc_interface_open(NULL, NULL, XC_OPENFLAG_NON_REENTRANT); + if (!xc) { + perror("xc_interface_open"); + goto out; + } + /* wait for vchan server to create *path* */ + xs_watch(xs, path, "path"); + xs_watch(xs, "@releaseDomain", "release"); + while ((watch_ret =3D xs_read_watch(xs, &watch_num))) { + /* don't care about exact which fired the watch */ + free(watch_ret); + ctrl =3D libxenvchan_client_init(NULL, domid, path); + if (ctrl) + break; + + ret =3D xc_domain_getinfo(xc, domid, 1, &dominfo); + /* break the loop if domain is definitely not there anymore, but + * continue if it is or the call failed (like EPERM) */ + if (ret =3D=3D -1 && errno =3D=3D ESRCH) + break; + if (ret =3D=3D 1 && (dominfo.domid !=3D (uint32_t)domid || dominfo= .dying)) + break; + } + +out: + if (xc) + xc_interface_close(xc); + if (xs) + xs_close(xs); + return ctrl; +} + + +static void discard_buffers(struct libxenvchan *ctrl) { + /* discard local buffers */ + insiz =3D 0; + outsiz =3D 0; + + /* discard remaining incoming data */ + while (libxenvchan_data_ready(ctrl)) { + if (libxenvchan_read(ctrl, inbuf, BUFSIZE) =3D=3D -1) { + perror("vchan read"); + exit(1); + } + } +} + +int data_loop(struct libxenvchan *ctrl, int input_fd, int output_fd) +{ + int ret; + int libxenvchan_fd; + int max_fd; + + libxenvchan_fd =3D libxenvchan_fd_for_select(ctrl); + for (;;) { + fd_set rfds; + fd_set wfds; + FD_ZERO(&rfds); + FD_ZERO(&wfds); + + max_fd =3D -1; + if (input_fd !=3D -1 && insiz !=3D BUFSIZE) { + FD_SET(input_fd, &rfds); + if (input_fd > max_fd) + max_fd =3D input_fd; + } + if (output_fd !=3D -1 && outsiz) { + FD_SET(output_fd, &wfds); + if (output_fd > max_fd) + max_fd =3D output_fd; + } + FD_SET(libxenvchan_fd, &rfds); + if (libxenvchan_fd > max_fd) + max_fd =3D libxenvchan_fd; + ret =3D select(max_fd + 1, &rfds, &wfds, NULL, NULL); + if (ret < 0) { + perror("select"); + exit(1); + } + if (FD_ISSET(libxenvchan_fd, &rfds)) { + libxenvchan_wait(ctrl); + if (!libxenvchan_is_open(ctrl)) { + if (verbose) + fprintf(stderr, "vchan client disconnected\n"); + while (outsiz) + socket_wr(output_fd); + close(output_fd); + close(input_fd); + discard_buffers(ctrl); + break; + } + vchan_wr(ctrl); + } + + if (FD_ISSET(input_fd, &rfds)) { + ret =3D read(input_fd, inbuf + insiz, BUFSIZE - insiz); + if (ret < 0 && errno !=3D EAGAIN) + exit(1); + if (verbose) + fprintf(stderr, "from-unix: %.*s\n", ret, inbuf + insiz); + if (ret =3D=3D 0) { + /* EOF on socket, write everything in the buffer and close= the + * input_fd socket */ + while (insiz) { + vchan_wr(ctrl); + libxenvchan_wait(ctrl); + } + close(input_fd); + input_fd =3D -1; + /* TODO: maybe signal the vchan client somehow? */ + break; + } + if (ret) + insiz +=3D ret; + vchan_wr(ctrl); + } + if (FD_ISSET(output_fd, &wfds)) + socket_wr(output_fd); + while (libxenvchan_data_ready(ctrl) && outsiz < BUFSIZE) { + ret =3D libxenvchan_read(ctrl, outbuf + outsiz, BUFSIZE - outs= iz); + if (ret < 0) + exit(1); + if (verbose) + fprintf(stderr, "from-vchan: %.*s\n", ret, outbuf + outsiz= ); + outsiz +=3D ret; + socket_wr(output_fd); + } + } + return 0; +} + +/** + Simple libxenvchan application, both client and server. + Both sides may write and read, both from the libxenvchan and from + stdin/stdout (just like netcat). +*/ + +static struct option options[] =3D { + { "mode", required_argument, NULL, 'm' }, + { "verbose", no_argument, NULL, 'v' }, + { "state-path", required_argument, NULL, 's' }, + { } +}; + +int main(int argc, char **argv) +{ + int is_server =3D 0; + int socket_fd =3D -1; + int input_fd, output_fd; + struct libxenvchan *ctrl =3D NULL; + const char *socket_path; + int domid; + const char *vchan_path; + const char *state_path =3D NULL; + int opt; + + while ((opt =3D getopt_long(argc, argv, "m:vs:", options, NULL)) !=3D = -1) { + switch (opt) { + case 'm': + if (strcmp(optarg, "server") =3D=3D 0) + is_server =3D 1; + else if (strcmp(optarg, "client") =3D=3D 0) + is_server =3D 0; + else { + fprintf(stderr, "invalid argument for --mode: %s\n", o= ptarg); + usage(argv); + return 1; + } + break; + case 'v': + verbose =3D 1; + break; + case 's': + state_path =3D optarg; + break; + case '?': + usage(argv); + } + } + + if (argc-optind !=3D 3) + usage(argv); + + domid =3D atoi(argv[optind]); + vchan_path =3D argv[optind+1]; + socket_path =3D argv[optind+2]; + + if (is_server) { + ctrl =3D libxenvchan_server_init(NULL, domid, vchan_path, 0, 0); + if (!ctrl) { + perror("libxenvchan_server_init"); + exit(1); + } + } else { + if (strcmp(socket_path, "-") =3D=3D 0) { + input_fd =3D 0; + output_fd =3D 1; + } else { + socket_fd =3D listen_socket(socket_path); + if (socket_fd =3D=3D -1) { + perror("listen socket"); + return 1; + } + } + } + + if (state_path) { + struct xs_handle *xs; + + xs =3D xs_open(0); + if (!xs) { + perror("xs_open"); + return 1; + } + if (!xs_write(xs, XBT_NULL, state_path, "running", strlen("running= "))) { + perror("xs_write"); + return 1; + } + xs_close(xs); + } + + for (;;) { + if (is_server) { + /* wait for vchan connection */ + while (libxenvchan_is_open(ctrl) !=3D 1) + libxenvchan_wait(ctrl); + /* vchan client connected, setup local FD if needed */ + if (strcmp(socket_path, "-") =3D=3D 0) { + input_fd =3D 0; + output_fd =3D 1; + } else { + input_fd =3D output_fd =3D connect_socket(socket_path); + } + if (input_fd =3D=3D -1) { + perror("connect socket"); + return 1; + } + if (data_loop(ctrl, input_fd, output_fd) !=3D 0) + break; + /* keep it running only when get UNIX socket path */ + if (socket_path[0] !=3D '/') + break; + } else { + /* wait for local socket connection */ + if (strcmp(socket_path, "-") !=3D 0) + input_fd =3D output_fd =3D accept(socket_fd, NULL, NULL); + if (input_fd =3D=3D -1) { + perror("accept"); + return 1; + } + set_nonblocking(input_fd, 1); + set_nonblocking(output_fd, 1); + ctrl =3D connect_vchan(domid, vchan_path); + if (!ctrl) { + perror("vchan client init"); + return 1; + } + if (data_loop(ctrl, input_fd, output_fd) !=3D 0) + break; + /* don't reconnect if output was stdout */ + if (strcmp(socket_path, "-") =3D=3D 0) + break; + + libxenvchan_close(ctrl); + ctrl =3D NULL; + } + } + return 0; +} --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046805; cv=none; d=zohomail.com; s=zohoarc; b=S3r5UZAShhCmrhbaeactPbPeJL+NlbwB7L0agexbNUCSQAxOYbtChniNj5zZYl8YQKUaV75zMOskOPHDKdkruMajKll1bXDSmEQNKq+O0PYcH9o7G9lzT2ooHEzNsbLTytTt9eUH56NRfzIDgUma6SQcsZSZ3FBXrMn09QamvNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046805; 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=5ROtHVehXF/HD8/78X0tTT0dK2u2H5EIad+/RrtpdTg=; b=G5+cD0nshknHCXGlNeWNOBC8IJQRyvQJTMpIhyYtR7ZsemztFUM99RWSNHU8roWuDQQCAA/Q3yYX5FglYTtLJfxSoXc2GftTA8AwFpGVBdZw3Xw/5+zlT0xjQSpSg0mxRQWFO9ZKwc9KWI/mR+/9D0vztV3ziN6nLMIOIWRgl8U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046805419643.3437071273796; Mon, 27 Apr 2020 21:06:45 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVr-0000rj-Ru; Tue, 28 Apr 2020 04:06:27 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVq-0000qH-2L for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:26 +0000 Received: from mail-qk1-x743.google.com (unknown [2607:f8b0:4864:20::743]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 96654e22-8905-11ea-b9cf-bc764e2007e4; Tue, 28 Apr 2020 04:06:07 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id c63so20582478qke.2 for ; Mon, 27 Apr 2020 21:06:07 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:06 -0700 (PDT) X-Inumbo-ID: 96654e22-8905-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5ROtHVehXF/HD8/78X0tTT0dK2u2H5EIad+/RrtpdTg=; b=P6O3nAlsgkTlkXmN+WDZpgbuwKGNNPWtCnPC3L0Hj51zAMoHm7Qn21i0IhM6nS5WOY RXNEZ27GuE2pkt0A8HgYn4Dmdmgnpbb/LY3HhDFAytBXp0E7mjdqc/myoL83YzxbnkFV yya8+Hu6eT4VZXb8fvsBb8Cfuw8nUZZyWUNJj7Nk41/gUBbFUT/ISvjrc7WLt9OsFOaj NUU/qubzeLQ9kazwDylwjj1dHO3dQCcolLpvGdFO8JcmwJoOxAJxpccbZXEoGmcjWNQI wVHToW1F5AlPqzezUkygkfSO4nl9h6x6u0FXwELLAReCrJkGhjvfK1mS2of+Tvqy1s9v Pb2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5ROtHVehXF/HD8/78X0tTT0dK2u2H5EIad+/RrtpdTg=; b=ch+77KcxsfkA+7HCVacSXW/YRSwbGMJAF7jwF4OgWkPplQUbipDS5q4pwF4FKTw9wP ZQ7HZWc8/l1reyii+Myxrp2tTgSyFvrN03VgHROGtryMXvNcMT9uwCYU375frTg0dkz9 E3hhzo0nl0Ggtzf6nPFWyg7atY3vgw4tCx1wtF5LIi+FI0sQASJpRJOYWbXJV6KGfcU8 5jF7tbcjl8WUoK9vPrtVymzeQL/f8fqJ88ktBKXl169ALJr6QikvfyqfYtjeAOdE060H 7V+aKfsDXm8ntXHki3oHzMI8FR2aGMIKuOtfaFdqLVDFQDrD0wAFiens8rLgNjUS7BSl yzHg== X-Gm-Message-State: AGi0PuYesVgzf/Jh4u3mix18aZeLuzfMcd20sGpiRaYiVLfOT3kBGyF+ V6BUrg19f/V10XA7Xt9u/gVkW+8Z X-Google-Smtp-Source: APiQypJcR19nCEvHNRTrQGfPB7p+WNgdZ1ISZps0CR6Nvzwdz9zVhohRx6RqqDgArjUAutTSgB3wMQ== X-Received: by 2002:a37:ac18:: with SMTP id e24mr26234983qkm.234.1588046767112; Mon, 27 Apr 2020 21:06:07 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 12/21] libxl: use vchan for QMP access with Linux stubdomain Date: Tue, 28 Apr 2020 00:04:24 -0400 Message-Id: <20200428040433.23504-13-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Access to QMP of QEMU in Linux stubdomain is possible over vchan connection. Handle the actual vchan connection in a separate process (vchan-socket-proxy). This simplified integration with QMP (already quite complex), but also allows preliminary filtering of (potentially malicious) QMP input. Since only one client can be connected to vchan server at the same time and it is not enforced by the libxenvchan itself, additional client-side locking is needed. It is implicitly implemented by vchan-socket-proxy, as it handle only one connection at a time. Note that qemu supports only one simultaneous client on a control socket anyway (but in UNIX socket case, it enforce it server-side), so it doesn't add any extra limitation. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- Changes in v4: - new patch, in place of both "libxl: use vchan for QMP access ..." Changes in v5: - Use device-model/%u/qmp-proxy-state xenstore path - Rephrase comment --- tools/configure.ac | 9 ++ tools/libxl/libxl_dm.c | 163 +++++++++++++++++++++++++++++++++-- tools/libxl/libxl_internal.h | 1 + 3 files changed, 165 insertions(+), 8 deletions(-) diff --git a/tools/configure.ac b/tools/configure.ac index ea0272766f..1c0ed4c3b1 100644 --- a/tools/configure.ac +++ b/tools/configure.ac @@ -192,6 +192,15 @@ AC_SUBST(qemu_xen) AC_SUBST(qemu_xen_path) AC_SUBST(qemu_xen_systemd) =20 +AC_ARG_WITH([stubdom-qmp-proxy], + AC_HELP_STRING([--stubdom-qmp-proxy@<:@=3DPATH@:>@], + [Use supplied binary PATH as a QMP proxy into stubdomain]),[ + stubdom_qmp_proxy=3D"$withval" +],[ + stubdom_qmp_proxy=3D"$bindir/vchan-socket-proxy" +]) +AC_DEFINE_UNQUOTED([STUBDOM_QMP_PROXY_PATH], ["$stubdom_qmp_proxy"], [QMP = proxy path]) + AC_ARG_WITH([system-seabios], AS_HELP_STRING([--with-system-seabios@<:@=3DPATH@:>@], [Use system supplied seabios PATH instead of building and installing diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 45d0dd56f5..e420c3fc7b 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1200,7 +1200,11 @@ static int libxl__build_device_model_args_new(libxl_= _gc *gc, GCSPRINTF("%d", guest_domid), NULL); flexarray_append(dm_args, "-no-shutdown"); =20 - /* There is currently no way to access the QMP socket in the stubdom */ + /* + * QMP access to qemu running in stubdomain is done over vchan. The + * stubdomain init script adds the appropriate monitor options for + * vchan-socket-proxy. + */ if (!is_stubdom) { flexarray_append(dm_args, "-chardev"); if (state->dm_monitor_fd >=3D 0) { @@ -2194,6 +2198,23 @@ static void stubdom_pvqemu_unpaused(libxl__egc *egc, static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, int rc, const char *p); =20 +static void spawn_qmp_proxy(libxl__egc *egc, + libxl__stub_dm_spawn_state *sdss); + +static void qmp_proxy_confirm(libxl__egc *egc, libxl__spawn_state *spawn, + const char *xsdata); + +static void qmp_proxy_startup_failed(libxl__egc *egc, + libxl__spawn_state *spawn, + int rc); + +static void qmp_proxy_detached(libxl__egc *egc, + libxl__spawn_state *spawn); + +static void qmp_proxy_spawn_outcome(libxl__egc *egc, + libxl__stub_dm_spawn_state *sdss, + int rc); + char *libxl__stub_dm_name(libxl__gc *gc, const char *guest_name) { return GCSPRINTF("%s-dm", guest_name); @@ -2476,24 +2497,150 @@ static void spawn_stub_launch_dm(libxl__egc *egc, goto out; } =20 + sdss->qmp_proxy_spawn.ao =3D ao; + if (libxl__stubdomain_is_linux(&guest_config->b_info)) { + spawn_qmp_proxy(egc, sdss); + } else { + qmp_proxy_spawn_outcome(egc, sdss, 0); + } + + return; + +out: + assert(ret); + qmp_proxy_spawn_outcome(egc, sdss, ret); +} + +static void spawn_qmp_proxy(libxl__egc *egc, + libxl__stub_dm_spawn_state *sdss) +{ + STATE_AO_GC(sdss->qmp_proxy_spawn.ao); + const uint32_t guest_domid =3D sdss->dm.guest_domid; + const uint32_t dm_domid =3D sdss->pvqemu.guest_domid; + const char *dom_path =3D libxl__xs_get_dompath(gc, dm_domid); + char **args; + int nr =3D 0; + int rc, logfile_w, null; + + if (access(STUBDOM_QMP_PROXY_PATH, X_OK) < 0) { + LOGED(ERROR, guest_domid, "qmp proxy %s is not executable", STUBDO= M_QMP_PROXY_PATH); + rc =3D ERROR_FAIL; + goto out; + } + + sdss->qmp_proxy_spawn.what =3D GCSPRINTF("domain %d device model qmp p= roxy", guest_domid); + sdss->qmp_proxy_spawn.pidpath =3D GCSPRINTF("%s/image/qmp-proxy-pid", = dom_path); + sdss->qmp_proxy_spawn.xspath =3D DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLST= ACK_DOMID, + dm_domid, "/qmp-pr= oxy-state"); + sdss->qmp_proxy_spawn.timeout_ms =3D LIBXL_DEVICE_MODEL_START_TIMEOUT = * 1000; + sdss->qmp_proxy_spawn.midproc_cb =3D libxl__spawn_record_pid; + sdss->qmp_proxy_spawn.confirm_cb =3D qmp_proxy_confirm; + sdss->qmp_proxy_spawn.failure_cb =3D qmp_proxy_startup_failed; + sdss->qmp_proxy_spawn.detached_cb =3D qmp_proxy_detached; + + const int arraysize =3D 6; + GCNEW_ARRAY(args, arraysize); + args[nr++] =3D STUBDOM_QMP_PROXY_PATH; + args[nr++] =3D GCSPRINTF("--state-path=3D%s", sdss->qmp_proxy_spawn.xs= path); + args[nr++] =3D GCSPRINTF("%u", dm_domid); + args[nr++] =3D GCSPRINTF("%s/device-model/%u/qmp-vchan", dom_path, gue= st_domid); + args[nr++] =3D (char*)libxl__qemu_qmp_path(gc, guest_domid); + args[nr++] =3D NULL; + assert(nr =3D=3D arraysize); + + logfile_w =3D libxl__create_qemu_logfile(gc, GCSPRINTF("qmp-proxy-%s", + sdss->dm_config.c= _info.name)); + if (logfile_w < 0) { + rc =3D logfile_w; + goto out; + } + null =3D open("/dev/null", O_RDWR); + if (null < 0) { + LOGED(ERROR, guest_domid, "unable to open /dev/null"); + rc =3D ERROR_FAIL; + goto out_close; + } + + rc =3D libxl__spawn_spawn(egc, &sdss->qmp_proxy_spawn); + if (rc < 0) + goto out_close; + if (!rc) { /* inner child */ + setsid(); + libxl__exec(gc, null, null, logfile_w, STUBDOM_QMP_PROXY_PATH, arg= s, NULL); + /* unreachable */ + } + + rc =3D 0; + +out_close: + if (logfile_w >=3D 0) + close(logfile_w); + if (null >=3D 0) + close(null); +out: + if (rc) + qmp_proxy_spawn_outcome(egc, sdss, rc); +} + +static void qmp_proxy_confirm(libxl__egc *egc, libxl__spawn_state *spawn, + const char *xsdata) +{ + STATE_AO_GC(spawn->ao); + + if (!xsdata) + return; + + if (strcmp(xsdata, "running")) + return; + + libxl__spawn_initiate_detach(gc, spawn); +} + +static void qmp_proxy_startup_failed(libxl__egc *egc, + libxl__spawn_state *spawn, + int rc) +{ + libxl__stub_dm_spawn_state *sdss =3D CONTAINER_OF(spawn, *sdss, qmp_pr= oxy_spawn); + qmp_proxy_spawn_outcome(egc, sdss, rc); +} + +static void qmp_proxy_detached(libxl__egc *egc, + libxl__spawn_state *spawn) +{ + libxl__stub_dm_spawn_state *sdss =3D CONTAINER_OF(spawn, *sdss, qmp_pr= oxy_spawn); + qmp_proxy_spawn_outcome(egc, sdss, 0); +} + +static void qmp_proxy_spawn_outcome(libxl__egc *egc, + libxl__stub_dm_spawn_state *sdss, + int rc) +{ + STATE_AO_GC(sdss->qmp_proxy_spawn.ao); + int need_pvqemu =3D libxl__need_xenpv_qemu(gc, &sdss->dm_config); + + if (rc) goto out; + + if (need_pvqemu < 0) { + rc =3D need_pvqemu; + goto out; + } + sdss->pvqemu.spawn.ao =3D ao; - sdss->pvqemu.guest_domid =3D dm_domid; sdss->pvqemu.guest_config =3D &sdss->dm_config; sdss->pvqemu.build_state =3D &sdss->dm_state; sdss->pvqemu.callback =3D spawn_stubdom_pvqemu_cb; - - if (!need_qemu) { + if (need_pvqemu) { + libxl__spawn_local_dm(egc, &sdss->pvqemu); + } else { /* If dom0 qemu not needed, do not launch it */ spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, 0); - } else { - libxl__spawn_local_dm(egc, &sdss->pvqemu); } =20 return; =20 out: - assert(ret); - spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, ret); + assert(rc); + spawn_stubdom_pvqemu_cb(egc, &sdss->pvqemu, rc); } =20 static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index a8f0eed945..00cfbe1fac 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -4159,6 +4159,7 @@ typedef struct { libxl__destroy_domid_state dis; libxl__multidev multidev; libxl__xswait_state xswait; + libxl__spawn_state qmp_proxy_spawn; } libxl__stub_dm_spawn_state; =20 _hidden void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_st= ate*); --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046815; cv=none; d=zohomail.com; s=zohoarc; b=Mo/ljW2ylHWHHHhTAnKgs5FBdQ4cnDt6nUjaw/B3o8RfmqxNv7o0TXEkT/LxId9Bv5oojkMBu+B49GGkYj7JuQ6vSuqyCKsaChxBaIvOZYJC8p7xOntENwqucu5uto4VHSZ0HO0tdTLHMLXlJkxJ9cnyxCas/dJeflNnUm9v/dY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046815; 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=V/z9lnZ0BRCy+VnythBjJZ2hhGpF1b82Kvc/b7advnU=; b=EmK8cKlQBW6NghQI9Qf7930Dt7066qbz4cvtgcSsEef7FoBZe/QiSKNvVmOqHyBtfskkxgw4wZ/oDjqcKydqWr4cSgTYPR5tcOBtc3aKFSa0+JySUTKIvzxHInHDoFRVMOweym6N/tqfrHVhf1J6NFu9OsJqdoq8RIarJFCwE3I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046815282453.9849402607115; Mon, 27 Apr 2020 21:06:55 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVw-0000w2-AJ; Tue, 28 Apr 2020 04:06:32 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHVv-0000uw-2a for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:31 +0000 Received: from mail-qk1-x736.google.com (unknown [2607:f8b0:4864:20::736]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 97cf9628-8905-11ea-9887-bc764e2007e4; Tue, 28 Apr 2020 04:06:10 +0000 (UTC) Received: by mail-qk1-x736.google.com with SMTP id 20so20510581qkl.10 for ; Mon, 27 Apr 2020 21:06:10 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:08 -0700 (PDT) X-Inumbo-ID: 97cf9628-8905-11ea-9887-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V/z9lnZ0BRCy+VnythBjJZ2hhGpF1b82Kvc/b7advnU=; b=q8wkYTHAKnhWREAxnGMsaBI2I5+A9JCTsJ7hKQ8+7bSR7oUX1XZiDxmLyxZKRMj0T3 Wr3k49T9e11IeTlJkKB2xIxgSyS3RUxOhyVC9yu33t0I2FRrfXJTFZGoJuZijF9idj3r ZwYmIEOMI7TPjZYXF1GtRtnXGoZxXSTZK5oQnWUjif3lx+hK+UW202v6f8QmKFXIcbQ1 5if9AuOnvbrIDibCqPSQz1UroUrvhsa7mdLuPEgDgNH2OBp1zAeLLO+E0Fv+9r8j58hY dkWnrN0JiFI75jnenO2ddBcCFF8SuRVR24ph053HGcTaBYJB3iK1IXNFtXfNDePebwb0 ooaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V/z9lnZ0BRCy+VnythBjJZ2hhGpF1b82Kvc/b7advnU=; b=PBGK2rVTfgomm9kqQy8TeWt0kVp/lKexcxh447GLmNcU5XLe1SX6MRbkSJzia4VdR/ wGLwPMAWe+0XckS/Ek1Ov8+3PxFCXfQ3qMqzjHcxkivb+Og9MapOm+CSkCAbD/p2FO4t 68N3fAxo4qUGNPUnqzwTyCOX1PBN5qZwgPpuzKNt5XYJwA7drEcmnaP+0rC4pYdrqB6F M0JWAjkw3GJwDIimQcSSz1Gb14o8KJ4HmmIK14D22gTgIWnBS29RdZuawJ5Dhat3uGwx YiCwXySQ2A0x4/6X01sJYLwEo3Pa2XCmtiRASoJVDACqerKWyWwm9UIaNjfMwEIz9tPk 51oA== X-Gm-Message-State: AGi0PuZP5mnWNmWVK3mh+16T22OmMLaWrNFXPMAdBCkwv2eQ9yDUPecd 0QwV4//DdB7aZsa2lFSxbx4pjIyw X-Google-Smtp-Source: APiQypIvLkZzfSVB1plttzJ6y6qYj5X45wQJja+PvCKKj+WyiRCGg2ns9uvaHgA/oyELOz1BuY+/YA== X-Received: by 2002:a37:387:: with SMTP id 129mr25703101qkd.147.1588046769511; Mon, 27 Apr 2020 21:06:09 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 13/21] Regenerate autotools files Date: Tue, 28 Apr 2020 00:04:25 -0400 Message-Id: <20200428040433.23504-14-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , Jason Andryuk , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Samuel Thibault Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Since we have those generated files committed to the repo (why?!), update them after changing configure.ac. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk --- configure | 14 +------------- docs/configure | 14 +------------- stubdom/configure | 14 +------------- tools/config.h.in | 3 +++ tools/configure | 46 ++++++++++++++++++++++++++++------------------ 5 files changed, 34 insertions(+), 57 deletions(-) diff --git a/configure b/configure index 9da3970cef..8af54e8a5a 100755 --- a/configure +++ b/configure @@ -644,7 +644,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -723,7 +722,6 @@ datadir=3D'${datarootdir}' sysconfdir=3D'${prefix}/etc' sharedstatedir=3D'${prefix}/com' localstatedir=3D'${prefix}/var' -runstatedir=3D'${localstatedir}/run' includedir=3D'${prefix}/include' oldincludedir=3D'/usr/include' docdir=3D'${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -976,15 +974,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=3Dyes ;; =20 - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=3Drunstatedir ;; - -runstatedir=3D* | --runstatedir=3D* | --runstatedi=3D* | --runstated=3D= * \ - | --runstate=3D* | --runstat=3D* | --runsta=3D* | --runst=3D* | --runs= =3D* \ - | --run=3D* | --ru=3D* | --r=3D*) - runstatedir=3D$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=3Dsbindir ;; -sbindir=3D* | --sbindir=3D* | --sbindi=3D* | --sbind=3D* | --sbin=3D* \ @@ -1122,7 +1111,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=3D\$$ac_var # Remove trailing slashes. @@ -1275,7 +1264,6 @@ Fine tuning of the installation directories: --sysconfdir=3DDIR read-only single-machine data [PREFIX/etc] --sharedstatedir=3DDIR modifiable architecture-independent data [PREF= IX/com] --localstatedir=3DDIR modifiable single-machine data [PREFIX/var] - --runstatedir=3DDIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=3DDIR object code libraries [EPREFIX/lib] --includedir=3DDIR C header files [PREFIX/include] --oldincludedir=3DDIR C header files for non-gcc [/usr/include] diff --git a/docs/configure b/docs/configure index 9e3ed60462..93e9dcf404 100755 --- a/docs/configure +++ b/docs/configure @@ -634,7 +634,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -711,7 +710,6 @@ datadir=3D'${datarootdir}' sysconfdir=3D'${prefix}/etc' sharedstatedir=3D'${prefix}/com' localstatedir=3D'${prefix}/var' -runstatedir=3D'${localstatedir}/run' includedir=3D'${prefix}/include' oldincludedir=3D'/usr/include' docdir=3D'${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -964,15 +962,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=3Dyes ;; =20 - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=3Drunstatedir ;; - -runstatedir=3D* | --runstatedir=3D* | --runstatedi=3D* | --runstated=3D= * \ - | --runstate=3D* | --runstat=3D* | --runsta=3D* | --runst=3D* | --runs= =3D* \ - | --run=3D* | --ru=3D* | --r=3D*) - runstatedir=3D$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=3Dsbindir ;; -sbindir=3D* | --sbindir=3D* | --sbindi=3D* | --sbind=3D* | --sbin=3D* \ @@ -1110,7 +1099,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=3D\$$ac_var # Remove trailing slashes. @@ -1263,7 +1252,6 @@ Fine tuning of the installation directories: --sysconfdir=3DDIR read-only single-machine data [PREFIX/etc] --sharedstatedir=3DDIR modifiable architecture-independent data [PREF= IX/com] --localstatedir=3DDIR modifiable single-machine data [PREFIX/var] - --runstatedir=3DDIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=3DDIR object code libraries [EPREFIX/lib] --includedir=3DDIR C header files [PREFIX/include] --oldincludedir=3DDIR C header files for non-gcc [/usr/include] diff --git a/stubdom/configure b/stubdom/configure index da03da535a..f7604a37f7 100755 --- a/stubdom/configure +++ b/stubdom/configure @@ -661,7 +661,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -751,7 +750,6 @@ datadir=3D'${datarootdir}' sysconfdir=3D'${prefix}/etc' sharedstatedir=3D'${prefix}/com' localstatedir=3D'${prefix}/var' -runstatedir=3D'${localstatedir}/run' includedir=3D'${prefix}/include' oldincludedir=3D'/usr/include' docdir=3D'${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1004,15 +1002,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=3Dyes ;; =20 - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=3Drunstatedir ;; - -runstatedir=3D* | --runstatedir=3D* | --runstatedi=3D* | --runstated=3D= * \ - | --runstate=3D* | --runstat=3D* | --runsta=3D* | --runst=3D* | --runs= =3D* \ - | --run=3D* | --ru=3D* | --r=3D*) - runstatedir=3D$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=3Dsbindir ;; -sbindir=3D* | --sbindir=3D* | --sbindi=3D* | --sbind=3D* | --sbin=3D* \ @@ -1150,7 +1139,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=3D\$$ac_var # Remove trailing slashes. @@ -1303,7 +1292,6 @@ Fine tuning of the installation directories: --sysconfdir=3DDIR read-only single-machine data [PREFIX/etc] --sharedstatedir=3DDIR modifiable architecture-independent data [PREF= IX/com] --localstatedir=3DDIR modifiable single-machine data [PREFIX/var] - --runstatedir=3DDIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=3DDIR object code libraries [EPREFIX/lib] --includedir=3DDIR C header files [PREFIX/include] --oldincludedir=3DDIR C header files for non-gcc [/usr/include] diff --git a/tools/config.h.in b/tools/config.h.in index 5a5944ebe1..5abf6092de 100644 --- a/tools/config.h.in +++ b/tools/config.h.in @@ -123,6 +123,9 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS =20 +/* QMP proxy path */ +#undef STUBDOM_QMP_PROXY_PATH + /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 diff --git a/tools/configure b/tools/configure index 4fa5f7b937..fef684f0be 100755 --- a/tools/configure +++ b/tools/configure @@ -770,7 +770,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -811,6 +810,7 @@ with_linux_backend_modules enable_qemu_traditional enable_rombios with_system_qemu +with_stubdom_qmp_proxy with_system_seabios with_system_ovmf enable_ipxe @@ -896,7 +896,6 @@ datadir=3D'${datarootdir}' sysconfdir=3D'${prefix}/etc' sharedstatedir=3D'${prefix}/com' localstatedir=3D'${prefix}/var' -runstatedir=3D'${localstatedir}/run' includedir=3D'${prefix}/include' oldincludedir=3D'/usr/include' docdir=3D'${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1149,15 +1148,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=3Dyes ;; =20 - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=3Drunstatedir ;; - -runstatedir=3D* | --runstatedir=3D* | --runstatedi=3D* | --runstated=3D= * \ - | --runstate=3D* | --runstat=3D* | --runsta=3D* | --runst=3D* | --runs= =3D* \ - | --run=3D* | --ru=3D* | --r=3D*) - runstatedir=3D$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=3Dsbindir ;; -sbindir=3D* | --sbindir=3D* | --sbindi=3D* | --sbind=3D* | --sbin=3D* \ @@ -1295,7 +1285,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=3D\$$ac_var # Remove trailing slashes. @@ -1448,7 +1438,6 @@ Fine tuning of the installation directories: --sysconfdir=3DDIR read-only single-machine data [PREFIX/etc] --sharedstatedir=3DDIR modifiable architecture-independent data [PREF= IX/com] --localstatedir=3DDIR modifiable single-machine data [PREFIX/var] - --runstatedir=3DDIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=3DDIR object code libraries [EPREFIX/lib] --includedir=3DDIR C header files [PREFIX/include] --oldincludedir=3DDIR C header files for non-gcc [/usr/include] @@ -1531,6 +1520,9 @@ Optional Packages: Use system supplied qemu PATH or qemu (taken from $PATH) as qemu-xen device model instead of build= ing and installing our own version + --stubdom-qmp-proxy[=3DPATH] + Use supplied binary PATH as a QMP proxy into + stubdomain --with-system-seabios[=3DPATH] Use system supplied seabios PATH instead of buil= ding and installing our own version @@ -3378,7 +3370,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -3424,7 +3416,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -3448,7 +3440,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.= $ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -3493,7 +3485,7 @@ else We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -3517,7 +3509,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.= $ac_ext We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ -#define LARGE_OFF_T ((((off_t) 1 << 31) << 31) - 1 + (((off_t) 1 << 31) <<= 31)) +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 =3D=3D 721 && LARGE_OFF_T % 2147483647 =3D=3D 1) ? 1 : -1]; @@ -4519,6 +4511,24 @@ _ACEOF =20 =20 =20 +# Check whether --with-stubdom-qmp-proxy was given. +if test "${with_stubdom_qmp_proxy+set}" =3D set; then : + withval=3D$with_stubdom_qmp_proxy; + stubdom_qmp_proxy=3D"$withval" + +else + + stubdom_qmp_proxy=3D"$bindir/vchan-socket-proxy" + +fi + + +cat >>confdefs.h <<_ACEOF +#define STUBDOM_QMP_PROXY_PATH "$stubdom_qmp_proxy" +_ACEOF + + + # Check whether --with-system-seabios was given. if test "${with_system_seabios+set}" =3D set; then : withval=3D$with_system_seabios; --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046813; cv=none; d=zohomail.com; s=zohoarc; b=bzp2VNuCYQkNyxyUIQgkK3tR1vxCVlSDUK1VWuivOYtgvWIQHdcgmFqtdvmndZ89vdgqe6I2n2HDbGsMBVkwEMUfUCEBRrLbUrl7P0DjWbBqWziB/jdz5rxX6i7dGM2LnDxDRxYd26qVEnVpShIHqLkKxw1l2PhpICyFPO82rAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046813; 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=V6avmJFZc+UWlxb0gGCz2wXyfeB09ISjRm2mBdCGWKo=; b=JfhtpMSqXDJP+Jb6p9oKsqK7t8Nx0Tg71QhCi+fi0fAUEFf3FWttOZcsJQnwiT3p7SCp6USVFyOIuzvM1eRSP3LIK12mwV1yr86TkXYA77UeWylDqM6skXoNDyCS4SZAABHsEP15HutEydoh9ZYYIXMs85CIBDGJEDFgVXVB6G4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 15880468131140.5783380357605665; Mon, 27 Apr 2020 21:06:53 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHW1-000105-JN; Tue, 28 Apr 2020 04:06:37 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHW0-0000yu-34 for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:36 +0000 Received: from mail-qt1-x841.google.com (unknown [2607:f8b0:4864:20::841]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 98fb0b72-8905-11ea-b9cf-bc764e2007e4; Tue, 28 Apr 2020 04:06:12 +0000 (UTC) Received: by mail-qt1-x841.google.com with SMTP id x12so15749996qts.9 for ; Mon, 27 Apr 2020 21:06:12 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:11 -0700 (PDT) X-Inumbo-ID: 98fb0b72-8905-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V6avmJFZc+UWlxb0gGCz2wXyfeB09ISjRm2mBdCGWKo=; b=gHhcNzKd0B20C9Seb4++4x1AHSa6TgznykVY3MOBbi33xEoDIMvUyUQ0gf38MLA7pi k38QmKbgz41K+Re/IQ3O6ICmwEt+IsjmwhGbHrc/6lltqvGPqOiIhgz7hKXRsQ8WELfO NsRBUnJzu/aIihfDz8VRX98qrJCfPWFVK5lIZKRksJVgwZ3xDfBAYKcKf+T3qBcEc//O zDb3zVZOu3h0uZ5oE+h4mga4YOkTV8ko6z5kCkAln6ot+SKTlWTsZ1d1yh7Tvv+wwbGX Zv9Kbm/s4IYfSEbuVL5u8Bi/ec2kZ4XtW7Qk4SAHtDmBc1t4jzV0kEh5YUJLkvYlaa7F 8ymg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V6avmJFZc+UWlxb0gGCz2wXyfeB09ISjRm2mBdCGWKo=; b=OuWrx8pxT+a3o2vzsFtZMMbvAdcjOUF34zh/89lNBaGrXW2YIMXJGil+9AwaBi00wt ikRQ9jZkZNUF3UfKkXrnac1pOKOnZIFJz9k/YmiG1RoRtw1rk2oR1szznHQwKyqqeaLi Iy4cwr7yCKzr77TYWNtUXOoI++GFYQzHnRLclQLU36NgA/Yv97ZIzowvNpXpmgsgHzhb 7MvR29XOeXt1I/kZN0DqyxW/3T2SE2zIuw4SjFqDZO5a6iJU6b/U+ozLYuLKDO/KPMGO 0aZ05B6PMMLUetkyzsR4WIcdOwHjXyH0/huXTfG0rPAlTPiW1Q4OJxvMwBJFRBncCfcy AB0A== X-Gm-Message-State: AGi0Pubvof+kEQwRiC+7RlELKHwGA33vakzaWf0VOXaJtoKEW9hUQW6j K6Guy4rfbyql9ygaCFfRVW/SKc3j X-Google-Smtp-Source: APiQypLtIFkRQ9ztGRweNh7AvLHZZFN3cakXNXaLfZXUPmzuAF73gA4rDryPkiibyzokzqgib7/NvA== X-Received: by 2002:ac8:12c2:: with SMTP id b2mr26438790qtj.7.1588046771686; Mon, 27 Apr 2020 21:06:11 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 14/21] libxl: require qemu in dom0 even if stubdomain is in use Date: Tue, 28 Apr 2020 00:04:26 -0400 Message-Id: <20200428040433.23504-15-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Until xenconsoled learns how to handle multiple consoles, this is needed for save/restore support (qemu state is transferred over secondary consoles). Additionally, Linux-based stubdomain waits for all the backends to initialize during boot. Lack of some console backends results in stubdomain startup timeout. This is a temporary patch until xenconsoled will be improved. Signed-off-by: Marek Marczykowski-G=C3=B3recki Signed-off-by: Jason Andryuk --- tools/libxl/libxl_dm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index e420c3fc7b..5e5e7a27b3 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2484,7 +2484,11 @@ static void spawn_stub_launch_dm(libxl__egc *egc, } } =20 - need_qemu =3D libxl__need_xenpv_qemu(gc, dm_config); + /* + * Until xenconsoled learns how to handle multiple consoles, require q= emu + * in dom0 to serve consoles for a stubdomain - it require at least 3 = of them. + */ + need_qemu =3D 1 || libxl__need_xenpv_qemu(gc, &sdss->dm_config); =20 for (i =3D 0; i < num_console; i++) { libxl__device device; @@ -2616,7 +2620,11 @@ static void qmp_proxy_spawn_outcome(libxl__egc *egc, int rc) { STATE_AO_GC(sdss->qmp_proxy_spawn.ao); - int need_pvqemu =3D libxl__need_xenpv_qemu(gc, &sdss->dm_config); + /* + * Until xenconsoled learns how to handle multiple consoles, require q= emu + * in dom0 to serve consoles for a stubdomain - it require at least 3 = of them. + */ + int need_pvqemu =3D 1 || libxl__need_xenpv_qemu(gc, &sdss->dm_config); =20 if (rc) goto out; =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046816; cv=none; d=zohomail.com; s=zohoarc; b=E6aLGjQQiWWp1u5kM3o/3JTMopLv53y9FNR+vV9/80IpOAnCt1VilQBErEUDsZ5XSAS9sTRt9BT58umbBMK05qObjWQMTEI2v5Zevdc2wLVdMGq4ADwfnfYZkLBLdTe4YBoHeJeVFhRmQ2sMpAwWjbgKcWxzUp6zY4s4Rce20fE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046816; 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=YHrTNz7tUN0rhzka1j5HZ0Hi5er6+RNP2GXkixa7DZ0=; b=PaQB1Bx1CGVtcEKf/KonNCK/E9W/IgxHErUqGhgcWzly1JlqLgtqrh41MI1QFJnnzMx+ox4QPlKNmY86Aegy4lIaIgo6tu0XDRrrUxJl8h3nVkm5VGOlfl4AWiZjYVHqEBABV5EbGaa1EvRtS5CzRvoI40H2AkiyX6O+F2sgsQs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046816023702.3178082495732; Mon, 27 Apr 2020 21:06:56 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHW6-000155-UC; Tue, 28 Apr 2020 04:06:42 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHW5-000133-39 for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:41 +0000 Received: from mail-qt1-x844.google.com (unknown [2607:f8b0:4864:20::844]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9a67bcd0-8905-11ea-b9cf-bc764e2007e4; Tue, 28 Apr 2020 04:06:14 +0000 (UTC) Received: by mail-qt1-x844.google.com with SMTP id o10so16293260qtr.6 for ; Mon, 27 Apr 2020 21:06:14 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:13 -0700 (PDT) X-Inumbo-ID: 9a67bcd0-8905-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YHrTNz7tUN0rhzka1j5HZ0Hi5er6+RNP2GXkixa7DZ0=; b=KAI4oMLxyg3xRmENF7haPFheBvn4T3kZi+YuTHh2Mmc9InbCorIxcghMes5jhjE+yC vvkrY9I3RYVxSE2+9IJjegn8obmRQV9Re4LYWORn441i04NPgeSjJ9A9scacv1f4Kfje AGUHF12l2Jx4JhoO6dVYFXwnqqEvorUxfWva2M+OUw+ZwCXmWma36dhFX/FmL1UIX3I7 7DWLe1u7M3dwgxD3pIMZK0V0jrdfDBK0Kl2UIOTeUZ2JTK6LP8jRIBkA9XM2pfRexJ1q ashqcgQQn2LL0aHO3Jz2I3CVhUDc3dzeFGf4hoHadAppY6FFVKRGqNrqEybESITJeRrj lFfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YHrTNz7tUN0rhzka1j5HZ0Hi5er6+RNP2GXkixa7DZ0=; b=oMZ1OVkctMa9LLkx1Tc/OFu9qboDTPSJvFEOLihSdU+M+j4Khv0XlvTTL+Zb9ICSqZ mi6Di5/L+ma7KtIjlyNfixoNll/IJox083JYzkHC1qZCgulq7eFbFKNcWgBRt30ffRaW MG9TJBM2cXUJo3fMX9n0iySxBw+eG+iayoq8A3uKKU55efocXst71QkrPT5dnZ3ZEdnD Vrhbxh8mZ1PW5v8xbhE+33S2P8Fn/AitQUfmF/L6TDagBHQd9juzWGTJLvCiCniUq8T/ nn3NXeAJOtddN5Wu1gaFXCKJ4eABRhlqDDjPw6hGSiC6vkW4lbWqkCcushsOALC8Xw9t IhGA== X-Gm-Message-State: AGi0PuZeeMeyFVG6yj/7UTkM/E+r25VIj4a0eGbkuXfX1PBMzI8Y7rfW mb+H2tldVMLrC6lx9VtY+cGYd9LN X-Google-Smtp-Source: APiQypKF61HS+kx09HNopaG/vRRFYcaVVZv+78ro8jhSj9i+JGmvZMcS7GD1DlUW/ybvMVPjplME2g== X-Received: by 2002:ac8:7ca2:: with SMTP id z2mr26929152qtv.122.1588046774039; Mon, 27 Apr 2020 21:06:14 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 15/21] libxl: ignore emulated IDE disks beyond the first 4 Date: Tue, 28 Apr 2020 00:04:27 -0400 Message-Id: <20200428040433.23504-16-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Qemu supports only 4 emulated IDE disks, when given more (or with higher indexes), it will fail to start. Since the disks can still be accessible using PV interface, just ignore emulated path and log a warning, instead of rejecting the configuration altogether. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- tools/libxl/libxl_dm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 5e5e7a27b3..03d7a38f1f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1891,6 +1891,13 @@ static int libxl__build_device_model_args_new(libxl_= _gc *gc, } =20 if (disks[i].is_cdrom) { + if (disk > 4) { + LOGD(WARN, guest_domid, "Emulated CDROM can be only on= e of the first 4 disks.\n" + "Disk %s will be available via PV drivers but not= as an " + "emulated disk.", + disks[i].vdev); + continue; + } drive =3D libxl__sprintf(gc, "if=3Dide,index=3D%d,readonly=3Don,media=3Dcdrom,= id=3Dide-%i", disk, dev_number); @@ -1968,6 +1975,10 @@ static int libxl__build_device_model_args_new(libxl_= _gc *gc, &disks[i], colo_mode); } else { + LOGD(WARN, guest_domid, "Only 4 emulated IDE disks are= supported.\n" + "Disk %s will be available via PV drivers but not= as an " + "emulated disk.", + disks[i].vdev); continue; /* Do not emulate this disk */ } =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046820; cv=none; d=zohomail.com; s=zohoarc; b=RC6MMHIeJVlqnR5H2wiKsFpC64BbO3nImFE00uFbDnjmCz9Gqsw2+ylMRJ4rEQWccLweFabDV8ejTyq4YgIV83RFQDzanQ0v7qDc1J9md6mrHdOrAtqLilGCuXxYGmoG7qkOAEUEJfkT1MXNPNVRd+tmwNIAgk9miNvKGUMuScw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046820; 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=0j8wm36LGsZqMjdI5/1E69Neum61HZiB3dp5bB5iUEk=; b=fVtIS+hhqSJuYn+S1UsvkUFHBUXkpsIFprKc0Sm1KtRo77piD+MwNsaC5kI/3j0czhe2x9erC9R5l4SFKQmh2HsxuSxQ7DPtaI1ebDihmmsI2gks4JCz17pVhjeubpneRo9JtZaGwrJYv1sEFCUNL8jnm0bc8iw3IfuLlPCV/+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046820386518.2439044230033; Mon, 27 Apr 2020 21:07:00 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWB-00019C-7z; Tue, 28 Apr 2020 04:06:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWA-00017y-3R for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:46 +0000 Received: from mail-qk1-x744.google.com (unknown [2607:f8b0:4864:20::744]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9ba326e8-8905-11ea-b9cf-bc764e2007e4; Tue, 28 Apr 2020 04:06:16 +0000 (UTC) Received: by mail-qk1-x744.google.com with SMTP id g74so20494237qke.13 for ; Mon, 27 Apr 2020 21:06:16 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:15 -0700 (PDT) X-Inumbo-ID: 9ba326e8-8905-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0j8wm36LGsZqMjdI5/1E69Neum61HZiB3dp5bB5iUEk=; b=Mdu81/O2RzmWfDxrvXDw5rcc1CZ6Xsh4Q18owuxthBbFAIgut43vsvxCJ4saCVC95N 2woUMyQQ5Kgz8JAqz+/A3kTNKHC25OIUtIqEu59BUqArpKQ6pi5UOvASRlIKYWF0+bSz wiK08CdkoRJeROnUx8cXmKSLHdD39dszJpukRMdZ9LFxSFg03vRm52vm9GIUqDePXcqf lBHIVyuNNnBB3TmRsIPKan15vbyljHbNdUmP0MaF/cmIYlsgZPvK3cFiDJMhip6YLKvP 8HL+RfdXNCAsxgxUzbLMWY2BKQior59rBQnore4RImww8eXrxAQSFQQA56KLSLyAfG8j BWRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0j8wm36LGsZqMjdI5/1E69Neum61HZiB3dp5bB5iUEk=; b=lMS1NfveQLpEo2Wltx2Ob8kQvt4LxF3UY2rbDjTTv9WOH03aKbje05ay1Fv9t8d6zJ RjKTL4SvHxDAtRdo6P6xjoTcKKfvtqou2sN10aBvWL9zObB8qp8IzvYsViDPh1OFBJkk dinc+UZCrE/m6tJJYoXiDxuzANjzTWVG0DqFG9M/mKwQ5gLylPH2ytt9+x0Viobh1q/5 MrMrFmARt3rQ6lkz3m77vjxA5xiGUO2o25ni77ZLFKY93o/8KDUErPHyO/AwrNFy/QUI MSalfCzBBLyJbdkGScjXrSzxu2K+usZTRgP7Mcjiq2378aBflseEKghxO6YbR42lYyQr 5kdA== X-Gm-Message-State: AGi0PuZyzaKHWJFbSBkUIurqE54J+LlM+qIIsYYxL/BP3wYKVImhDc8I 1A5ttNz4Y+ELaxREistDuskAEs9G X-Google-Smtp-Source: APiQypIAfqI9RLEm3UJaxI6J7R1wp5n5o3ctkhdgmYwxhOYUKYvV+Y/lYiibhmQO8rNP5tVYJRf73w== X-Received: by 2002:a05:620a:2091:: with SMTP id e17mr9825551qka.70.1588046776119; Mon, 27 Apr 2020 21:06:16 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 16/21] libxl: consider also qemu in stubdomain in libxl__dm_active check Date: Tue, 28 Apr 2020 00:04:28 -0400 Message-Id: <20200428040433.23504-17-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Marek Marczykowski-G=C3=B3recki Since qemu-xen can now run in stubdomain too, handle this case when checking it's state too. Signed-off-by: Marek Marczykowski-G=C3=B3recki Reviewed-by: Jason Andryuk Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- tools/libxl/libxl_dm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 03d7a38f1f..5d61da1de8 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -3749,12 +3749,18 @@ out: =20 int libxl__dm_active(libxl__gc *gc, uint32_t domid) { - char *pid, *path; + char *pid, *dm_domid, *path; =20 path =3D GCSPRINTF("/local/domain/%d/image/device-model-pid", domid); pid =3D libxl__xs_read(gc, XBT_NULL, path); =20 - return pid !=3D NULL; + if (pid) + return true; + + path =3D GCSPRINTF("/local/domain/%d/image/device-model-domid", domid); + dm_domid =3D libxl__xs_read(gc, XBT_NULL, path); + + return dm_domid !=3D NULL; } =20 int libxl__dm_check_start(libxl__gc *gc, libxl_domain_config *d_config, --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046832; cv=none; d=zohomail.com; s=zohoarc; b=FVojfHSxYPOD94NWDA0PqhasFfHXGLcls8s8cwMQAU3T1kmz673SbDKYRi2rBsKdsr2BH5wz3QvSLkhNa6tpLYgKL2CJyn440WOj40cNQdmXRi1skMb9FVElvHSiBVIVGnkEOHEytzS6X1n/EAeUmzEL0/yvmciAALQuETFotOA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046832; h=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=RNheJoXDK0K0JeJe6uhrnBacMxojGYzO1+cdpKez/ow=; b=bIzOy7PHWVTovFClQb1ztINTUgjgWJn9s3lrGEnDPFKM3xLbUv7sDskpNYIsaPf7Utk//pu5kF7tNubZfkJ8v35BuitYBveiHd3VGPYffn3JOb+7fuTwPmWN8UhU0BmBr990YytO2rgH2hCZPhZDrLPcK7HLqU6/2LUbEFghVO8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 158804683275716.31444226155793; Mon, 27 Apr 2020 21:07:12 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWG-0001F1-PM; Tue, 28 Apr 2020 04:06:52 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWF-0001DT-3g for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:51 +0000 Received: from mail-qk1-x743.google.com (unknown [2607:f8b0:4864:20::743]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9d2d764e-8905-11ea-b9cf-bc764e2007e4; Tue, 28 Apr 2020 04:06:19 +0000 (UTC) Received: by mail-qk1-x743.google.com with SMTP id 20so20510772qkl.10 for ; Mon, 27 Apr 2020 21:06:19 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:17 -0700 (PDT) X-Inumbo-ID: 9d2d764e-8905-11ea-b9cf-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RNheJoXDK0K0JeJe6uhrnBacMxojGYzO1+cdpKez/ow=; b=WF44xZ98MbEqysIwXm59CFTp7aVINuuJNv49m5uht/uEANPnERO56jm3GpsAysKbpp u5GIEPaV4UCT/QZXDhHMriZYU6011lernF5uW+ohugKx5G44zXnSN8ZByu7OWQpHXRkL u7Inx1zus8PDNMjAu0Dysd7egNcSc4xA92TpeZitx5E4fN1bYilHbHABK5olfjgis1EG cf5Vc34F96HxiNUYtPXN75X5Xa/iHdt8JAeys/zcXKdpSR2zpc2diqkbKJ4Z+WPWaOvf /zdS2Qk3sG/+dchcPINlOHQaP+C5vQ36JgllafTIn5V8CHjaYHFrjjrnxB5rzHcb/m33 WdfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RNheJoXDK0K0JeJe6uhrnBacMxojGYzO1+cdpKez/ow=; b=mlgOyzwVCXw1auTsyzmRMeE8ro4j0Y1yVQUZ7Dli8e3aZyowm1fTq3+oLTYVmDrshm ME9TxU4mwvr/AVdkiN3ITS6LRaVhmFwx3lrRkWWsRhgaWRxd9A6QLDkGStbsHytpkjaw PrcGjnh8vh9lkaHxLNBRqZypHloJHpvnTNRxKs03A+ogmzW1fjHU2tO9mfdOnlIO6TCF 1LppCLCNm/z9Vn7KmgGAUrKNeuyMLG1Tdi0DL2K/VmAyZM3rIRvFHxLKiEGzGkBW4ynV C2X35sP84SQm6tMUoNwQ+lxiGZoj6F3KjEBx+dpoEEQpG3Eng3/uZ11hycBLHV5/LxbV 8UOg== X-Gm-Message-State: AGi0PubKwC+i69Rv7wtzPESt00DhtmHmJ0bMebc1o5Zav9dL/YWPZzBb Nyg4DwNeGixaNXzZvl//nN6ne4W0 X-Google-Smtp-Source: APiQypKTQrnyHkhvu7IhjdgEeifBCZzOtEu99tsC1xbisqoyyUiV5TFZ2REIzDzPQ9iZAzsOuVpVMw== X-Received: by 2002:a05:620a:13b5:: with SMTP id m21mr25161994qki.208.1588046778722; Mon, 27 Apr 2020 21:06:18 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 17/21] docs: Add device-model-domid to xenstore-paths Date: Tue, 28 Apr 2020 00:04:29 -0400 Message-Id: <20200428040433.23504-18-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Stefano Stabellini , Julien Grall , Wei Liu , Jason Andryuk , Andrew Cooper , George Dunlap , Jan Beulich , Ian Jackson Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Document device-model-domid for when using a device model stubdomain. Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- docs/misc/xenstore-paths.pandoc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/misc/xenstore-paths.pandoc b/docs/misc/xenstore-paths.pan= doc index a152f5ea68..766e8008dc 100644 --- a/docs/misc/xenstore-paths.pandoc +++ b/docs/misc/xenstore-paths.pandoc @@ -148,6 +148,11 @@ The domain's own ID. The process ID of the device model associated with this domain, if it has one. =20 +#### ~/image/device-model-domid =3D INTEGER [INTERNAL] + +The domain ID of the device model stubdomain associated with this domain, +if it has one. + #### ~/cpu/[0-9]+/availability =3D ("online"|"offline") [PV] =20 One node for each virtual CPU up to the guest's configured --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046832; cv=none; d=zohomail.com; s=zohoarc; b=n845Sw2VuV56Q7iSPD5QOe5Ev/wkfSfXPtZv0zfK5UrOLUnpYumlFNhbaJOHtw/6lGO+GJBIC3LeJI/Gs2r/qAK9ySf39DM+yywx7pQFKW8duy1LR0gR0+MfWqmZm3WcwQPoyhfih6cP5l/Ussn9It33p7IwP35T2vDFvw/KbrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046832; h=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=tSVk0kCBf7n4qF0esOSMv85t4GqldCzE2h0PjonxwNo=; b=OazCI5LqibpKdLCZJo4rQYuMXIX2c5ahcqQNrXiBM/Z5YjfBDI8hnzupVd+WtHDBbaOiX0EK5zvqTTqyDR1PTpAbNbjy3Ugy2hvV1CC9MoYh4EgYKkRxzIYl+InCWaFfhfhxjQoKZssUvmbGFypa6I4hpVUZSt+1YWMYKYmcfbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 158804683202899.69028033030065; Mon, 27 Apr 2020 21:07:12 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWM-0001Ku-3f; Tue, 28 Apr 2020 04:06:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWK-0001Iw-3t for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:06:56 +0000 Received: from mail-qv1-xf43.google.com (unknown [2607:f8b0:4864:20::f43]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9e6a4e92-8905-11ea-9887-bc764e2007e4; Tue, 28 Apr 2020 04:06:21 +0000 (UTC) Received: by mail-qv1-xf43.google.com with SMTP id y19so9757487qvv.4 for ; Mon, 27 Apr 2020 21:06:21 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:20 -0700 (PDT) X-Inumbo-ID: 9e6a4e92-8905-11ea-9887-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tSVk0kCBf7n4qF0esOSMv85t4GqldCzE2h0PjonxwNo=; b=tb3C2eJPTwYyxOnSmKGXZljy6Xj8fMhjs5HuQD8Vo64C3gCYuL18KIppYOHXsYwK7S 9MlT9sfKYnoL164NSLh0g6nALsr6TQLbIT5Z2v0NJr2du8KnF0ipA624WA5okByRMqq8 suG1EkswxIIiMTevCVjug9Jd1YYMRxRWK/E6+kwITZef1w/hcKo2Bqtdu2DThZwJC7Qd MPnmf0qOCrzws/GMBLD/u+mm9eoezCeUVSMG4LRCY3xIz0eOgWm/R1dFNyzAc7bogJa0 c4Z9mXQcIDTqcU6jL7yB8uCpOcU/Kue6I2mQHzlW3Y2fuq7ybh95BI57VZi25QTcxmnQ 6rdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tSVk0kCBf7n4qF0esOSMv85t4GqldCzE2h0PjonxwNo=; b=cVcmxGvUqxisn40Y+HCmsk+ESt2+nZFpw511vF3NMncUwnVdqPcgpQDNINeoxJq1Pf qWjsK3JtjV828HfwwFlNZUp4f1hBTx/LQNw54oB2WEHgUQUyt7SwVUzCr5T9LGfTpZZh 10WvZ7RnsoFJcTQ90QEdVf2fMQfiSlXREZg4QR/kwbwldmpboRQ36kk/qHhViYoa2A+D VLdwfkcwLvPMIWqNTXNS4Owu/FrtfsGHioHDLpnCDwoOj/XU2CgfiIq7IBPJg8IfS+Rl Btlpwu4G1gaCVrpWisybvGGtftPnp9pmUlP2Br6lQvV8h2rMZb3N37yZArTZ/f1qhdA9 jmBQ== X-Gm-Message-State: AGi0PuYqG2kLqTMemEywuf2p6QN9ehtKBWzmf4F8ZXsynXtsFh6c6JJm 1wJ9qlPsI8copSYHlS7oP++Dw/AY X-Google-Smtp-Source: APiQypKCttcK2Qg1o1j3J3JV4xEZ+88l5p38LSqrSIpq5oCLR1KYCeyyYSPJ6jK6YDCgqvheDVdG6w== X-Received: by 2002:a0c:da0e:: with SMTP id x14mr26232279qvj.47.1588046780850; Mon, 27 Apr 2020 21:06:20 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 18/21] libxl: Check stubdomain kernel & ramdisk presence Date: Tue, 28 Apr 2020 00:04:30 -0400 Message-Id: <20200428040433.23504-19-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Just out of context is the following comment for libxl__domain_make: /* fixme: this function can leak the stubdom if it fails */ When the stubdomain kernel or ramdisk is not present, the domid and stubdomain name will indeed be leaked. Avoid the leak by checking the file presence and erroring out when absent. It doesn't fix all cases, but it avoids a big one when using a linux device model stubdomain. Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- tools/libxl/libxl_dm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 5d61da1de8..a57c13bdf4 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2316,6 +2316,22 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__st= ub_dm_spawn_state *sdss) dm_config->num_vkbs =3D 1; } =20 + if (guest_config->b_info.stubdomain_kernel && + access(guest_config->b_info.stubdomain_kernel, R_OK) !=3D 0) { + LOGED(ERROR, guest_domid, "could not access stubdomain kernel %s", + guest_config->b_info.stubdomain_kernel); + ret =3D ERROR_INVAL; + goto out; + } + + if (guest_config->b_info.stubdomain_ramdisk && + access(guest_config->b_info.stubdomain_ramdisk, R_OK) !=3D 0) { + LOGED(ERROR, guest_domid, "could not access stubdomain ramdisk %s", + guest_config->b_info.stubdomain_ramdisk); + ret =3D ERROR_INVAL; + goto out; + } + stubdom_state->pv_kernel.path =3D guest_config->b_info.stubdomain_kern= el; stubdom_state->pv_ramdisk.path =3D guest_config->b_info.stubdomain_ram= disk; =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046835; cv=none; d=zohomail.com; s=zohoarc; b=bYzQQU3bhc7oYjb8YG8C3LgdkovvfbQNe18Ag44Ll06cLT/79kk6UX+qT9jhow30bVXG4R5V0eCgW0LqH/ihJHr9oLBK8lX1KpWSvlTPnPMCho9YuC7RvS0zPlxCCgK9nC1gdeHU85JGnDR/wROkK9lRZV471ffwHUcgYXEOS4w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046835; h=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=6DQChgQe+3bSXOEkWGb6D1mzdbV5n3lQYWfTuCEquu8=; b=dv3m7BZWTFEWCD5+5geCtMLuDTQmfOfg3r0xu4cirjv+zVddrFbLwmu5REq+5QxAe3BFzjknpYxibwhxYqmnKTLV65aWzFVXXyw9RzT4VgiGswrf7bNjTuEMiLL0QBwgDajdzMvAO7lrKBtBH0QLos1pyO2d7EQMwh2OjXyQOog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046835641395.83796420124713; Mon, 27 Apr 2020 21:07:15 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWQ-0001Om-EQ; Tue, 28 Apr 2020 04:07:02 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWP-0001Nr-49 for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:07:01 +0000 Received: from mail-qk1-x742.google.com (unknown [2607:f8b0:4864:20::742]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 9fb25ad8-8905-11ea-9887-bc764e2007e4; Tue, 28 Apr 2020 04:06:23 +0000 (UTC) Received: by mail-qk1-x742.google.com with SMTP id t3so20591207qkg.1 for ; Mon, 27 Apr 2020 21:06:23 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:22 -0700 (PDT) X-Inumbo-ID: 9fb25ad8-8905-11ea-9887-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6DQChgQe+3bSXOEkWGb6D1mzdbV5n3lQYWfTuCEquu8=; b=Xse0tAdbdB+fF1IFKZRUS6Q/2MFCrE/2W06iDpxBq7FbgQC2NuqemaAC+9W8hkPvjG RqfHvzkCNFw0RhDpx9gbkTyscUSqwwx27vcOZ1aHw5AXlhA3p19LUHtcuLW9qT0rcsI/ /pLIQBDW1oqSM1YXXe8B9TaNlKsAxzYdv2ynChzZ0jal7NlQkA2iv2vgm6kVyjxYV0mU EzOazIJ39GlhuF4YzXL88CYZdy6D0bDW8MeGEKZnogBP8RgM9o2RQ0LG5BgqEe/J25JC LayBQ9TrDy0f+tJ1kOiciYt4/bP2/3/BrMzrNzGT88IcBzcLK1ZAXO3tqJXCd3634KMe 2e7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6DQChgQe+3bSXOEkWGb6D1mzdbV5n3lQYWfTuCEquu8=; b=sZsnEMzYTmNbsL0N9pv7MsKQkm3fquB0vI8C3wbp5zTx+1d5Mq4FXi1wmYOiNH8CfR /HqzCZuzJp7Fwdo/VxpVXwgC0lH9oQsdj6t26vE8tZUpxlmuBgwfNiFkUs1Sb1cPcb/Q r81p2O9ZDHnG3iXPdm6VWM/PAorTB18Pd2FidFIPRQ1mQNP4F2QpeFRc0xWaahxM9aiT eVpeo24npYbSgCwjgDt9EEf3PaDEIgVyu+3qqcE8X92vtp/Zw+2NGryBs7c325/3aMDq 8nrPkK/OIlwABj3ugPpQ19lt5sqkaJhmUORuIE3Da7CQK8D+MbC6K1+sCf8kq11/bxI9 mv6A== X-Gm-Message-State: AGi0PuawhNxJC+gG5krOqTo/KuYnaViA9wbgJNpgIxvibioUynPWm4xN cfsg+8WuxWJW+ZAD/olMGDR2rQbJ X-Google-Smtp-Source: APiQypL32vsxRZanS1NtlmQKFUKLhxnlSdDfEXm+decCbPDZhmOs0AEQ68A8akHQ39nI7acivelvmQ== X-Received: by 2002:a05:620a:13b9:: with SMTP id m25mr25458664qki.456.1588046782950; Mon, 27 Apr 2020 21:06:22 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 19/21] libxl: Refactor kill_device_model to libxl__kill_xs_path Date: Tue, 28 Apr 2020 00:04:31 -0400 Message-Id: <20200428040433.23504-20-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Move kill_device_model to libxl__kill_xs_path so we have a helper to kill a process from a pid stored in xenstore. We'll be using it to kill vchan-qmp-proxy. libxl__kill_xs_path takes a "what" string for use in printing error messages. kill_device_model is retained in libxl_dm.c to provide the string. Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- tools/libxl/libxl_aoutils.c | 32 ++++++++++++++++++++++++++++++++ tools/libxl/libxl_dm.c | 27 +-------------------------- tools/libxl/libxl_internal.h | 3 +++ 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c index 1be858c93c..c4c095a5ba 100644 --- a/tools/libxl/libxl_aoutils.c +++ b/tools/libxl/libxl_aoutils.c @@ -626,6 +626,38 @@ void libxl__kill(libxl__gc *gc, pid_t pid, int sig, co= nst char *what) what, (unsigned long)pid, sig); } =20 +/* Generic function to signal (HUP) a pid stored in xenstore */ +int libxl__kill_xs_path(libxl__gc *gc, const char *xs_path_pid, + const char *what) +{ + const char *xs_pid; + int ret, pid; + + ret =3D libxl__xs_read_checked(gc, XBT_NULL, xs_path_pid, &xs_pid); + if (ret || !xs_pid) { + LOG(ERROR, "unable to find %s pid in %s", what, xs_path_pid); + ret =3D ret ? : ERROR_FAIL; + goto out; + } + pid =3D atoi(xs_pid); + + ret =3D kill(pid, SIGHUP); + if (ret < 0 && errno =3D=3D ESRCH) { + LOG(ERROR, "%s already exited", what); + ret =3D 0; + } else if (ret =3D=3D 0) { + LOG(DEBUG, "%s signaled", what); + ret =3D 0; + } else { + LOGE(ERROR, "failed to kill %s [%d]", what, pid); + ret =3D ERROR_FAIL; + goto out; + } + +out: + return ret; +} + /* * Local variables: * mode: C diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index a57c13bdf4..10ca4226ba 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -3397,32 +3397,7 @@ out: /* Generic function to signal a Qemu instance to exit */ static int kill_device_model(libxl__gc *gc, const char *xs_path_pid) { - const char *xs_pid; - int ret, pid; - - ret =3D libxl__xs_read_checked(gc, XBT_NULL, xs_path_pid, &xs_pid); - if (ret || !xs_pid) { - LOG(ERROR, "unable to find device model pid in %s", xs_path_pid); - ret =3D ret ? : ERROR_FAIL; - goto out; - } - pid =3D atoi(xs_pid); - - ret =3D kill(pid, SIGHUP); - if (ret < 0 && errno =3D=3D ESRCH) { - LOG(ERROR, "Device Model already exited"); - ret =3D 0; - } else if (ret =3D=3D 0) { - LOG(DEBUG, "Device Model signaled"); - ret =3D 0; - } else { - LOGE(ERROR, "failed to kill Device Model [%d]", pid); - ret =3D ERROR_FAIL; - goto out; - } - -out: - return ret; + return libxl__kill_xs_path(gc, xs_path_pid, "Device Model"); } =20 /* Helper to destroy a Qdisk backend */ diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 00cfbe1fac..32aa797714 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -2707,6 +2707,9 @@ int libxl__async_exec_start(libxl__async_exec_state *= aes); bool libxl__async_exec_inuse(const libxl__async_exec_state *aes); =20 _hidden void libxl__kill(libxl__gc *gc, pid_t pid, int sig, const char *wh= at); +/* kill SIGHUP a pid stored in xenstore */ +_hidden int libxl__kill_xs_path(libxl__gc *gc, const char *xs_path_pid, + const char *what); =20 /*----- device addition/removal -----*/ =20 --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046843; cv=none; d=zohomail.com; s=zohoarc; b=V9kIb+h3n3RPh+YfaKX4Mg6+8tV3Zs7nDWlSKrbX3lc8rwFCNCLZ1e1sQq2Zck2UGcXzkOswCkkl0Khrv76W1UQArRr3xbNtSiB5YWTao2VA6V56jCC9BUGmutiRnkHT+XnHD9EYKJ1Mr5gopYsNKNvk25sxbWbC6bz8lWZ5pGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046843; h=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=OmhxLHIrfW/RVN+5SOVZowWAiFw0cbMfDhtgV3wqCnU=; b=Axr2+BQ8R83bZBj1nNWt2HEif+NkpAtslbC/C9VFjkIBiwAndbGiQSaYGxdwtcfHAe2R1D4/X0mfZOYRT5KBLEB35QmuSU+1kZYc0hG5T06Y16VWGuqGEbsJ0dSw8NpDZv48zXD02XOv4Jr8wAmGpe6FkqNkIznPoqQpzCbOQ+0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 158804684363833.17283953860044; Mon, 27 Apr 2020 21:07:23 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWV-0001U8-PS; Tue, 28 Apr 2020 04:07:07 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWU-0001SI-4H for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:07:06 +0000 Received: from mail-qv1-xf42.google.com (unknown [2607:f8b0:4864:20::f42]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a1128498-8905-11ea-b07b-bc764e2007e4; Tue, 28 Apr 2020 04:06:25 +0000 (UTC) Received: by mail-qv1-xf42.google.com with SMTP id y19so9757542qvv.4 for ; Mon, 27 Apr 2020 21:06:25 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:24 -0700 (PDT) X-Inumbo-ID: a1128498-8905-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OmhxLHIrfW/RVN+5SOVZowWAiFw0cbMfDhtgV3wqCnU=; b=bg3Zvrsiv9zFYEa7cM5egtX3ROnTgjnrSRZM1p8HrJD7F7FrT7TlrnPZGsmZzEzL4J b/2pDHw/WTDLcNYgFN0+74nMz9im+XtS3TQNEewchEmgSc70bLKM4JEAJvw1sBsQvkFi f3z2EBAxhoF9o24idxWib8NC3zFgfUlM9o+5ULORuy7gzdWgd9uezem5DxhTHDX62V43 KBVVWGTX40Dr7YF081F9jzvfsquJ++gCRlf1rfpeC67SaAyzHGJaiqijK+6EEY+l3FC0 THR95kTDJ8g9MrQnJwMjvcf3RSpK2gRnTE2CE7BVOZu4mplpvRWZr/XIDx4VgbNhK3Rq i6iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OmhxLHIrfW/RVN+5SOVZowWAiFw0cbMfDhtgV3wqCnU=; b=m6XvqjW87BozZVH5zFj2cA5jZTUGFz6tzQrzocTySwtHDZM4m00zTkRg5bm8iq3hp4 QTmCT9/Z+quEN3jrjvZzhpoblDo03ufoUZVYpLkuIW9QE7TEo7/793WdmYv2jul4yego ti5RNve2I0DW894kyy6wrMXonHSMZYJWlg4MmwNpIRVDLBssu0R5jQsD3z6ANEuF/r0e gcvODuSWLALg83NsOk7eF/TQMSUw4O28vBlNoTRCsdI2DVBrxn26f/0YyV+W4aSbS7eX 0jhuckqTcr9lQ5jlRZwccRhiyPTMvXBHhlGZzatI3NkODmnqJSLwsjBq2xoYwuK3qlDq FEDQ== X-Gm-Message-State: AGi0PubbDDpT1j9Q3lBNCnwifcjTBIiX7wcfn6+FC+j+olMSfeAzGnI/ zbfHve+uMaNnNkdxSnEWAsYvnvI9 X-Google-Smtp-Source: APiQypI52GnSDDusVyNK8D3yfYR5vLp0fsZOWFVjbEe/0XywspZxG4Cr6dMdTn7fq5ST5MCLx8XDQw== X-Received: by 2002:a0c:99ca:: with SMTP id y10mr19107544qve.217.1588046785230; Mon, 27 Apr 2020 21:06:25 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 20/21] libxl: Kill vchan-socket-proxy when cleaning up qmp Date: Tue, 28 Apr 2020 00:04:32 -0400 Message-Id: <20200428040433.23504-21-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Ian Jackson , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" We need to kill the vchan-socket-proxy so we don't leak the daemonized processes. libxl__stubdomain_is_linux_running works against the guest_domid, but the xenstore path is beneath the stubdomain. This leads to the use of libxl_is_stubdom in addition to libxl__stubdomain_is_linux_running so that the stubdomain calls kill for the qmp-proxy Signed-off-by: Jason Andryuk Acked-by: Ian Jackson --- libxl__qmp_cleanup was considered, but it is not called for guests with a stubdomain. --- tools/libxl/libxl_domain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/libxl_domain.c b/tools/libxl/libxl_domain.c index fef2cd4e13..3b66e25aa7 100644 --- a/tools/libxl/libxl_domain.c +++ b/tools/libxl/libxl_domain.c @@ -1260,10 +1260,17 @@ static void dm_destroy_cb(libxl__egc *egc, libxl__destroy_domid_state *dis =3D CONTAINER_OF(ddms, *dis, ddms); STATE_AO_GC(dis->ao); uint32_t domid =3D dis->domid; + uint32_t target_domid; =20 if (rc < 0) LOGD(ERROR, domid, "libxl__destroy_device_model failed"); =20 + if (libxl_is_stubdom(CTX, domid, &target_domid) && + libxl__stubdomain_is_linux_running(gc, target_domid)) { + char *path =3D GCSPRINTF("/local/domain/%d/image/qmp-proxy-pid", d= omid); + libxl__kill_xs_path(gc, path, "QMP Proxy"); + } + dis->drs.ao =3D ao; dis->drs.domid =3D domid; dis->drs.callback =3D devices_destroy_cb; --=20 2.20.1 From nobody Sun Apr 28 15:59:35 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1588046846; cv=none; d=zohomail.com; s=zohoarc; b=Dpe2fNpw9pWelll2RuPWEXNBI4rv1Il+SkXm/bBdGkbhyPB6//FIpnd4+dDJJKeZXZJHC84+carN+sINdvHFU3l+Nblrbqy/gZEc1+tK0qA5lf7fcO1+rxGJkvfmwmGn2JolEJ9Ski0cB7Lo3yf0x8UsgVMdW1oVnEaJdYZBGvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1588046846; h=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=62xznBzAJrZ5cBLJ6CH8pd+32QEr+JtnkMAlzxn5W2w=; b=GgKIhYqJcvqEVl1viGEQkaCMO7VU8VPhVpEREjHrV6FBVa1FJZrYjbjoPTxpNaia5wDZDva8RuD0vLX4dswo/wQw32541G1+s1dtPQcm1N1u16iJo1VZh5+QXt331E0ykZcWi5tHljgoloSP2frASp/JpyoDd/dHm1guqjrMFWU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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 1588046846561533.8195299488924; Mon, 27 Apr 2020 21:07:26 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWb-0001Yz-2z; Tue, 28 Apr 2020 04:07:13 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jTHWZ-0001XE-4f for xen-devel@lists.xenproject.org; Tue, 28 Apr 2020 04:07:11 +0000 Received: from mail-qv1-xf41.google.com (unknown [2607:f8b0:4864:20::f41]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a27849d0-8905-11ea-b07b-bc764e2007e4; Tue, 28 Apr 2020 04:06:28 +0000 (UTC) Received: by mail-qv1-xf41.google.com with SMTP id ck5so2986161qvb.11 for ; Mon, 27 Apr 2020 21:06:28 -0700 (PDT) Received: from shine.lan ([2001:470:8:67e:f1d1:23b9:fc94:a1a9]) by smtp.gmail.com with ESMTPSA id v2sm13445480qth.66.2020.04.27.21.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 21:06:26 -0700 (PDT) X-Inumbo-ID: a27849d0-8905-11ea-b07b-bc764e2007e4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=62xznBzAJrZ5cBLJ6CH8pd+32QEr+JtnkMAlzxn5W2w=; b=bXTbQKnEynKDrvf8b9s3N/Gt9pB8jg+WpOAo3c8oczvyv/ZvMx+Vz3Bn27Up4YWLhM pmI5N8dyG6Pn80b8u4Rs/p5RxJUa0F7ar1LyF35vSW78hZaMa2OuEACpw/PLuYyov53k MmNcd5WjTDs2x3P5BjU1YDc+ONa/e89QUC/sd1cj2y3b+EOmQVuViqLcE8Y194DIlQ8R /ZVPOE+ylmS4+QEEEKxVwZ2ZYS2AtEKLUAwdH0hMbt5W8dWS0nhwUXM+df/lQEjZZnsI I+gZPwCllD/WUwUX61N31ah7t1g+yc8XKuGuR/ZtdwSqjjOXTiYIIJmOClGJX1VgAWsA yWUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=62xznBzAJrZ5cBLJ6CH8pd+32QEr+JtnkMAlzxn5W2w=; b=YTd2Xviyk3xILYpKkufTSXSgFFLeMhbMiXOzYNZlrO130JRyznnAzlRT2dzVAV5yHe Ok7N5PFKlMlc3QF4o8zW22dCKYvgAPveMzmXY1Eh1ecuxv3Y8Hcn90Woi6rGVssu5NuO 9kkpe9hgeDSCh9r50QQJcCVYYu4wLxzGsJu57BDDmFGIFd1/fWtZEmw2tWnkarx76SoO 69sh3V6S+qz/1jhoNBa4XeKU0s3vclyniVai3tjsAKdKo9mVtf7w5l0edFUAK5oLLyhl 0mU6R6fkzHQXXVv+sihMfBLAoTLtV+MVUe/MWBXA+XxELnJuAYgio0k7GBmHXYjTIuI1 x2mw== X-Gm-Message-State: AGi0PuZ3C7t97Yw8ixIxgMddEmYK5DWpbNfvidkVuUjpjOnsYAf0qXxy uFWegAJxV+2HNL3wmHChNgpmvmcm X-Google-Smtp-Source: APiQypJJz9jy7S7Ew3uCA+nDzpyziyVQvXa9uf0vY7aQB+TGNx4mkQ5nvc2OxG8y5z5GaMBVpJH3xQ== X-Received: by 2002:a05:6214:188a:: with SMTP id cx10mr26208160qvb.119.1588046787600; Mon, 27 Apr 2020 21:06:27 -0700 (PDT) From: Jason Andryuk To: xen-devel@lists.xenproject.org Subject: [PATCH v5 21/21] tools: Clean up vchan-socket-proxy socket Date: Tue, 28 Apr 2020 00:04:33 -0400 Message-Id: <20200428040433.23504-22-jandryuk@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200428040433.23504-1-jandryuk@gmail.com> References: <20200428040433.23504-1-jandryuk@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Ian Jackson , Wei Liu , Jason Andryuk Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" To avoid socket files lingering in /run/xen, have vchan-socket-proxy clean up the sockets it creates. Use a signal handler as well as atexit to handle both means of termination. Signed-off-by: Jason Andryuk --- tools/libvchan/vchan-socket-proxy.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tools/libvchan/vchan-socket-proxy.c b/tools/libvchan/vchan-soc= ket-proxy.c index 13700c5d67..0fb42964b5 100644 --- a/tools/libvchan/vchan-socket-proxy.c +++ b/tools/libvchan/vchan-socket-proxy.c @@ -33,6 +33,7 @@ =20 #include #include +#include #include #include #include @@ -88,6 +89,22 @@ char outbuf[BUFSIZE]; int insiz =3D 0; int outsiz =3D 0; int verbose =3D 0; +char *cleanup_socket; + +static void cleanup(void) +{ + if (cleanup_socket) { + unlink(cleanup_socket); + free(cleanup_socket); + cleanup_socket =3D NULL; + } +} + +static void cleanup_exit(int signum) +{ + cleanup(); + exit(0); +} =20 static void vchan_wr(struct libxenvchan *ctrl) { int ret; @@ -394,6 +411,9 @@ int main(int argc, char **argv) vchan_path =3D argv[optind+1]; socket_path =3D argv[optind+2]; =20 + signal(SIGHUP, cleanup_exit); + signal(SIGTERM, cleanup_exit); + if (is_server) { ctrl =3D libxenvchan_server_init(NULL, domid, vchan_path, 0, 0); if (!ctrl) { @@ -410,6 +430,8 @@ int main(int argc, char **argv) perror("listen socket"); return 1; } + cleanup_socket =3D strdup(socket_path); + atexit(cleanup); } } =20 --=20 2.20.1