From nobody Sun Nov 16 06:00:26 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1598552543; cv=none; d=zohomail.com; s=zohoarc; b=Agct65LyerzmN68xS+FNkvOAHbRfUwM8wfmNBxOyEUZ3Bngok6+vNIrLnzYHAvZrwLaB362ervcD9d6dMXaP4dRQHpyf1Bug5Zw4gnhQhKLAHJMEA2gYOO7s6wMZp+/+pf7Zfe8AIN5E3YoL+nw2c786SiTum519MeGIWKH5+a0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598552543; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=C2zYlbgUjh78gb8/f0N4TRIumkzhBi1rRYVFiDcIxEc=; b=i4klPRQBzFus4/OOCPLscuJRw5aLK5Fobw9TccIfZ5bBdG0Y++AQtHdEd+twznqTlhm5MlNt/ohbIuuZIJWV9/3NG4Xb+VC1jeQFf/kP2w/2roYO7/NWxhWGMtv11Tkk60gyYicdFaBirKF7LPt5+2S2OvTIvtfF2n7l/yU2OLM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1598552543127224.6718490571909; Thu, 27 Aug 2020 11:22:23 -0700 (PDT) Received: from localhost ([::1]:42824 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBMXV-0004Fn-KX for importer@patchew.org; Thu, 27 Aug 2020 14:22:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBMPA-0001x8-Ey for qemu-devel@nongnu.org; Thu, 27 Aug 2020 14:13:44 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:50024) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBMP8-0007Ku-99 for qemu-devel@nongnu.org; Thu, 27 Aug 2020 14:13:44 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07RI5LLE074591; Thu, 27 Aug 2020 18:13:36 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 333w6u6hm8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 Aug 2020 18:13:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 07RI4tVa072660; Thu, 27 Aug 2020 18:13:35 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 333r9nr071-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Aug 2020 18:13:35 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 07RIDYGg025744; Thu, 27 Aug 2020 18:13:34 GMT Received: from flaka.hsd1.ca.comcast.net (/10.159.136.159) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 27 Aug 2020 11:13:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=C2zYlbgUjh78gb8/f0N4TRIumkzhBi1rRYVFiDcIxEc=; b=uUZag/7bmK5RgQt7sYgFIZ5+FjV263uTlIX4IvWZQ4gWK3svtlSQZB0oYr7Z3QTmvrSx C717wKcyz9/Hf0PD9vqwWAQdUHGwhrIfFwPPCBwXmoGVPIOd0/QERmBzh31v4dA3HhTE mhCNwL9hKV+Myg6UQOvIQ0jf3iByZcObuRgeXiv7VHZbB/wzwbFVhO6HkLRJDWHjUtR+ orUeADjBn9uhgyRh00hMkZo4s3IMbv7aHWe4oq4KWXzkS/nuBLcaHJUWlttw19KasD47 NIE8iVf4/9u80Wv1nr02BjTDoTpv60sDLXKa1NoWj6Bm7V3+PyOPVcG1ya7HfFbNGq0z 9Q== From: elena.ufimtseva@oracle.com To: qemu-devel@nongnu.org Subject: [PATCH v9 20/20] multi-process: add configure and usage information Date: Thu, 27 Aug 2020 11:12:31 -0700 Message-Id: <20200827181231.22778-21-elena.ufimtseva@oracle.com> X-Mailer: git-send-email 2.25.GIT In-Reply-To: <20200827181231.22778-1-elena.ufimtseva@oracle.com> References: <20200827181231.22778-1-elena.ufimtseva@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9726 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 suspectscore=1 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008270136 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9726 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 impostorscore=0 mlxlogscore=999 suspectscore=1 phishscore=0 malwarescore=0 spamscore=0 priorityscore=1501 clxscore=1015 mlxscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2008270136 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.85; envelope-from=elena.ufimtseva@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/27 14:08:28 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.959, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: elena.ufimtseva@oracle.com, fam@euphon.net, swapnil.ingle@nutanix.com, john.g.johnson@oracle.com, kraxel@redhat.com, jag.raman@oracle.com, quintela@redhat.com, mst@redhat.com, armbru@redhat.com, kanth.ghatraju@oracle.com, felipe@nutanix.com, thuth@redhat.com, ehabkost@redhat.com, konrad.wilk@oracle.com, dgilbert@redhat.com, stefanha@redhat.com, thanos.makatos@nutanix.com, rth@twiddle.net, kwolf@redhat.com, berrange@redhat.com, mreitz@redhat.com, ross.lagerwall@citrix.com, marcandre.lureau@gmail.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Elena Ufimtseva Signed-off-by: Elena Ufimtseva Signed-off-by: Jagannathan Raman Signed-off-by: John G Johnson Reviewed-by: Stefan Hajnoczi --- MAINTAINERS | 2 ++ docs/multi-process.rst | 67 ++++++++++++++++++++++++++++++++++++++ scripts/mpqemu-launcher.py | 49 ++++++++++++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 docs/multi-process.rst create mode 100755 scripts/mpqemu-launcher.py diff --git a/MAINTAINERS b/MAINTAINERS index ffc4f321f6..acbe096976 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3059,6 +3059,8 @@ F: include/hw/pci/memory-sync.h F: hw/i386/remote-iohub.c F: include/hw/i386/remote-iohub.h F: docs/devel/multi-process.rst +F: scripts/mpqemu-launcher.py +F: scripts/mpqemu-launcher-perf-mode.py =20 Build and test automation ------------------------- diff --git a/docs/multi-process.rst b/docs/multi-process.rst new file mode 100644 index 0000000000..9dc55e37d1 --- /dev/null +++ b/docs/multi-process.rst @@ -0,0 +1,67 @@ +Multi-process QEMU +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +This document describes how to configure and use multi-process qemu. +For the design document refer to docs/devel/qemu-multiprocess. + +1) Configuration +---------------- + +To enable support for multi-process add --enable-mpqemu +to the list of options for the "configure" script. + + +2) Usage +-------- + +Multi-process QEMU requires an orchestrator to launch. Please refer to a +light-weight python based orchestrator for mpqemu in +scripts/mpqemu-launcher.py to lauch QEMU in multi-process mode. + +Following is a description of command-line used to launch mpqemu. + +* Orchestrator: + + - The Orchestrator creates a unix socketpair + + - It launches the remote process and passes one of the + sockets to it via command-line. + + - It then launches QEMU and specifies the other socket as an option + to the Proxy device object + +* Remote Process: + + - QEMU can enter remote process mode by using the "remote" machine + option. + + - The orchestrator creates a "remote-object" with details about + the device and the file descriptor for the device + + - The remaining options are no different from how one launches QEMU with + devices. + + - Example command-line for the remote process is as follows: + + /usr/bin/qemu-system-x86_64 \ + -machine remote \ + -device lsi53c895a,id=3Dlsi0 = \ + -drive id=3Ddrive_image2,file=3D/build/ol7-nvme-test-1.qcow2 = \ + -device scsi-hd,id=3Ddrive2,drive=3Ddrive_image2,bus=3Dlsi0.0,scsi-i= d=3D0 \ + -object remote-object,id=3Drobj1,devid=3Dlsi1,fd=3D4, + +* QEMU: + + - Since parts of the RAM are shared between QEMU & remote process, a + memory-backend-memfd is required to facilitate this, as follows: + + -object memory-backend-memfd,id=3Dmem,size=3D2G + + - A "pci-proxy-dev" device is created for each of the PCI devices emulat= ed + in the remote process. A "socket" sub-option specifies the other end of + unix channel created by orchestrator. The "id" sub-option must be spec= ified + and should be the same as the "id" specified for the remote PCI device + + - Example commandline for QEMU is as follows: + + -device pci-proxy-dev,id=3Dlsi0,socket=3D3 diff --git a/scripts/mpqemu-launcher.py b/scripts/mpqemu-launcher.py new file mode 100755 index 0000000000..07b11c6f0d --- /dev/null +++ b/scripts/mpqemu-launcher.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +import socket +import os +import subprocess +import time + +PROC_QEMU=3D'/usr/bin/qemu-system-x86_64' + +proxy, remote =3D socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM) + +remote_cmd =3D [ PROC_QEMU, = \ + '-machine', 'remote', = \ + '-device', 'lsi53c895a,id=3Dlsi1', = \ + '-drive', 'id=3Ddrive_image1,file=3D/build/ol7-nvme-test-1.= qcow2', \ + '-device', 'scsi-hd,id=3Ddrive1,drive=3Ddrive_image1,bus=3D= lsi1.0,' \ + 'scsi-id=3D0', = \ + '-object', = \ + 'remote-object,id=3Drobj1,devid=3Dlsi1,fd=3D'+str(remote.fi= leno()), \ + '-nographic', = \ + ] + +proxy_cmd =3D [ PROC_QEMU, = \ + '-name', 'OL7.4', = \ + '-machine', 'q35,accel=3Dkvm', = \ + '-smp', 'sockets=3D1,cores=3D1,threads=3D1', = \ + '-m', '2048', = \ + '-object', 'memory-backend-memfd,id=3Dsysmem-file,size=3D2G'= , \ + '-numa', 'node,memdev=3Dsysmem-file', = \ + '-device', 'virtio-scsi-pci,id=3Dvirtio_scsi_pci0', = \ + '-drive', 'id=3Ddrive_image1,if=3Dnone,format=3Dqcow2,' = \ + 'file=3D/home/ol7-hdd-1.qcow2', = \ + '-device', 'scsi-hd,id=3Dimage1,drive=3Ddrive_image1,' = \ + 'bus=3Dvirtio_scsi_pci0.0', = \ + '-boot', 'd', = \ + '-vnc', ':0', = \ + '-device', 'pci-proxy-dev,id=3Dlsi1,fd=3D'+str(proxy.fileno(= )), \ + ] + + +pid =3D os.fork(); + +if pid: + # In Proxy + print('Launching QEMU with Proxy object'); + process =3D subprocess.Popen(proxy_cmd, pass_fds=3D[proxy.fileno()]) +else: + # In remote + print('Launching Remote process'); + process =3D subprocess.Popen(remote_cmd, pass_fds=3D[remote.fileno()]) --=20 2.25.GIT