From patchwork Sun Jan 6 05:34:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam X-Patchwork-Id: 10749457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DE6A13BF for ; Sun, 6 Jan 2019 05:38:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F3AF2886F for ; Sun, 6 Jan 2019 05:38:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 202562880A; Sun, 6 Jan 2019 05:38:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from listsout.gnu.org (listsout.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A8BDE28830 for ; Sun, 6 Jan 2019 05:38:12 +0000 (UTC) Received: from localhost ([127.0.0.1]:48539 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg18V-00034O-P8 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 06 Jan 2019 00:38:11 -0500 Received: from eggsout.gnu.org ([209.51.188.92]:46067 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15z-0000ut-3X for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gg15u-0004IX-8R for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:35 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17758 helo=sender1.zoho.com.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15t-0004Dg-Hw for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:30 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1546752873; cv=none; d=zoho.com.cn; s=zohoarc; b=WquzJN5xYDg4zdgz0G+Qst4r0YIy7GNhNrx4PUqOohPD63x4bElFOKFM+PU1fgJUQD15NFBYwuOx5Tp46p4/VXdi/XYhwMx1ojMw23piy30xNMrmTYUSXycdU7EmDWT0cJ8hLyohSTjbbbWywvIsLfCUT3nhtqdnPXv2Dq/uJJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1546752873; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=Fb5hc+G6CN9iuGA//nSqw7ZVubWJmu8R+anBUfdqI0k=; b=IZfWwQI45vgbFwea4kv4W3E+JEFUGl4rnN4wsWF6EqCRSI07U+WVZJc/B1/YMRZabk5R2RLt+ZSYpSZ+obLtPvvcuj6tZv0+bJtd85BhBF1ZLLz3gUIO9Cr30ehRiIxzqdpihg1tLxjd5cJcZqsMHiRWNceZ/rCOIrtT3dJ65O8= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1546752873; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=2253; bh=Fb5hc+G6CN9iuGA//nSqw7ZVubWJmu8R+anBUfdqI0k=; b=Ppb91D/EB7xgM39O4qicelDKx9KyYCyNhSMuwLZMKCM05lEEto02hCdm4iIELp+/ 5csqMFQkSqOMb8JS4FzQtP9dYpJWiNB5GfVCS0o5q1UQLgj8vWu/DhCpcwTcCRXzpNG dqPTAKK5gyH7Us2MKdmyUyCWiX4aBO334KkTneH8= Received: from localhost (120.52.147.48 [120.52.147.48]) by mx.zoho.com.cn with SMTPS id 1546752871687651.7172534156; Sun, 6 Jan 2019 13:34:31 +0800 (CST) From: Fam Zheng To: qemu-devel@nongnu.org Date: Sun, 6 Jan 2019 13:34:07 +0800 Message-Id: <20190106053409.10712-2-fam@euphon.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190106053409.10712-1-fam@euphon.net> References: <20190106053409.10712-1-fam@euphon.net> X-ZohoCNMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 163.53.93.243 Subject: [Qemu-devel] [PULL 1/3] block/nvme: optimize the performance of nvme driver based on vfio-pci X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Li Feng When the IO size is larger than 2 pages, we move the the pointer one by one in the pagelist, this is inefficient. This is a simple benchmark result: Before: $ qemu-io -c 'write 0 1G' nvme://0000:00:04.0/1 wrote 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:02.41 (424.504 MiB/sec and 0.4146 ops/sec) $ qemu-io -c 'read 0 1G' nvme://0000:00:04.0/1 read 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:02.03 (503.055 MiB/sec and 0.4913 ops/sec) After: $ qemu-io -c 'write 0 1G' nvme://0000:00:04.0/1 wrote 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:02.17 (471.517 MiB/sec and 0.4605 ops/sec) $ qemu-io -c 'read 0 1G' nvme://0000:00:04.0/1 read 1073741824/1073741824 bytes at offset 0 1 GiB, 1 ops; 0:00:01.94 (526.770 MiB/sec and 0.5144 ops/sec) Signed-off-by: Li Feng Message-Id: <20181101103807.25862-1-lifeng1519@gmail.com> Signed-off-by: Fam Zheng --- block/nvme.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/block/nvme.c b/block/nvme.c index 29294038fc..982097b5b1 100644 --- a/block/nvme.c +++ b/block/nvme.c @@ -837,7 +837,7 @@ try_map: } for (j = 0; j < qiov->iov[i].iov_len / s->page_size; j++) { - pagelist[entries++] = iova + j * s->page_size; + pagelist[entries++] = cpu_to_le64(iova + j * s->page_size); } trace_nvme_cmd_map_qiov_iov(s, i, qiov->iov[i].iov_base, qiov->iov[i].iov_len / s->page_size); @@ -850,20 +850,16 @@ try_map: case 0: abort(); case 1: - cmd->prp1 = cpu_to_le64(pagelist[0]); + cmd->prp1 = pagelist[0]; cmd->prp2 = 0; break; case 2: - cmd->prp1 = cpu_to_le64(pagelist[0]); - cmd->prp2 = cpu_to_le64(pagelist[1]);; + cmd->prp1 = pagelist[0]; + cmd->prp2 = pagelist[1]; break; default: - cmd->prp1 = cpu_to_le64(pagelist[0]); - cmd->prp2 = cpu_to_le64(req->prp_list_iova); - for (i = 0; i < entries - 1; ++i) { - pagelist[i] = cpu_to_le64(pagelist[i + 1]); - } - pagelist[entries - 1] = 0; + cmd->prp1 = pagelist[0]; + cmd->prp2 = cpu_to_le64(req->prp_list_iova + sizeof(uint64_t)); break; } trace_nvme_cmd_map_qiov(s, cmd, req, qiov, entries); From patchwork Sun Jan 6 05:34:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Fam X-Patchwork-Id: 10749455 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F308A13BF for ; Sun, 6 Jan 2019 05:36:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E314C2880A for ; Sun, 6 Jan 2019 05:36:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D63372883A; Sun, 6 Jan 2019 05:36:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from listsout.gnu.org (listsout.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7417328834 for ; Sun, 6 Jan 2019 05:36:36 +0000 (UTC) Received: from localhost ([127.0.0.1]:48108 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg16w-0001km-Gc for patchwork-qemu-devel@patchwork.kernel.org; Sun, 06 Jan 2019 00:36:34 -0500 Received: from eggsout.gnu.org ([209.51.188.92]:46069 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15z-0000uu-41 for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gg15u-0004IP-75 for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:35 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17745 helo=sender1.zoho.com.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15r-00044p-Hx for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:29 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1546752874; cv=none; d=zoho.com.cn; s=zohoarc; b=HeH11AbKP92CB0pfh7C38Xawn2+MSNLWsj3UGewpW1T9uXS1odEkbkqAdZJ8n60sHQEYtCPqXmJ8gn9SHE+KSbkBEjV4Pi1myp7l6rHsz3OFWL+h+CYyv5ubpPZCl/1gIuk+lEsN96jWrkO91AY9WuV3O0cRD0h83UZAs8uTb4M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1546752874; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=jhq38tiZy+crr84voA/EAyFCLFGDmK1s91zaM9ARFC8=; b=kqEzFHGYvYIuoIGK2V8Z+g2tbYvvLOnJG21L4MJ9LgImLZCotlXYbVcxz9KOUoAfvfISuh5AGLmIUtePTpI/X2FC9mKsrkwBk1/tyhrcnO0NxE7/3dWUhuPtx+wOenH3hzyy2S1HAVb97X0K8NBzbLQRFBSRJDL+gva1t/35eIU= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1546752874; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Message-ID:Subject:Date:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding; l=2301; bh=jhq38tiZy+crr84voA/EAyFCLFGDmK1s91zaM9ARFC8=; b=BHjv8qfBiutnK8eQfLV8RDp4NKCviv0AhPB4yKhz2xOeBUocOJ/A9wiL+Zj6Rgqe jA0GeMgZLaMLPbNlRh6eAqLRaCD+tbVdrNYNa9vBS+Elus5WncfwGew3I0sP7EckH3+ LCs+fGscPE1H4mKwPtPXQs8U/D78j5/o3tRiSYlE= Received: from localhost (120.52.147.48 [120.52.147.48]) by mx.zoho.com.cn with SMTPS id 1546752872855226.77217624459809; Sun, 6 Jan 2019 13:34:32 +0800 (CST) From: Fam Zheng To: qemu-devel@nongnu.org Message-ID: <20190106053409.10712-3-fam@euphon.net> Date: Sun, 6 Jan 2019 13:34:08 +0800 X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190106053409.10712-1-fam@euphon.net> References: <20190106053409.10712-1-fam@euphon.net> MIME-Version: 1.0 X-ZohoCNMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 163.53.93.243 Subject: [Qemu-devel] [PULL 2/3] docker: Use a stable snapshot for Debian Sid X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Philippe Mathieu-Daudé The Debian Sid repository is not garanteed to be stable, as his 'unstable' name suggest :) To allow quick testing, Debian maintainers might push packages various time a day. Sometime package dependencies might break, which is annoying when using this repository for stable development (which is not recommended, but Sid provides edge packages we use for testing). Debian provides repositories snapshots which are suitable for our use. Pick a recent date that works. When required, update to newer releases will be easy. This fixes current issues with this image: $ make docker-image-debian-sid [...] The following packages have unmet dependencies: build-essential : Depends: dpkg-dev (>= 1.17.11) but it is not going to be installed git : Depends: perl but it is not going to be installed Depends: liberror-perl but it is not going to be installed pkg-config : Depends: libdpkg-perl but it is not going to be installed texinfo : Depends: perl (>= 5.26.2-6) but it is not going to be installed Depends: libtext-unidecode-perl but it is not going to be installed Depends: libxml-libxml-perl but it is not going to be installed E: Unable to correct problems, you have held broken packages. Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20181101183705.5422-1-philmd@redhat.com> Signed-off-by: Fam Zheng --- tests/docker/dockerfiles/debian-sid.docker | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/docker/dockerfiles/debian-sid.docker b/tests/docker/dockerfiles/debian-sid.docker index 9a3d168705..4e4cda0ba5 100644 --- a/tests/docker/dockerfiles/debian-sid.docker +++ b/tests/docker/dockerfiles/debian-sid.docker @@ -13,6 +13,10 @@ FROM debian:sid-slim +# Use a snapshot known to work (see http://snapshot.debian.org/#Usage) +ENV DEBIAN_SNAPSHOT_DATE "20181030" +RUN sed -i "s%^deb \(https\?://\)deb.debian.org/debian/\? \(.*\)%deb [check-valid-until=no] \1snapshot.debian.org/archive/debian/${DEBIAN_SNAPSHOT_DATE} \2%" /etc/apt/sources.list + # Duplicate deb line as deb-src RUN cat /etc/apt/sources.list | sed "s/^deb\ /deb-src /" >> /etc/apt/sources.list From patchwork Sun Jan 6 05:34:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam X-Patchwork-Id: 10749459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 56CEB91E for ; Sun, 6 Jan 2019 05:39:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A6D287B6 for ; Sun, 6 Jan 2019 05:39:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FAB8287CB; Sun, 6 Jan 2019 05:39:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 66E39287B6 for ; Sun, 6 Jan 2019 05:39:24 +0000 (UTC) Received: from localhost ([127.0.0.1]:48896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg19f-00046x-KT for patchwork-qemu-devel@patchwork.kernel.org; Sun, 06 Jan 2019 00:39:23 -0500 Received: from eggsout.gnu.org ([209.51.188.92]:46098 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg161-0000v9-Co for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gg15z-0004MH-2t for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:37 -0500 Received: from sender2-op-o12.zoho.com.cn ([163.53.93.243]:17747 helo=sender1.zoho.com.cn) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gg15y-0004Kf-Fc for qemu-devel@nongnu.org; Sun, 06 Jan 2019 00:35:35 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1546752884; cv=none; d=zoho.com.cn; s=zohoarc; b=qEYD5p++zAYj7TkoukiDOHZS1O8QLYOPcrm8ls/4epBFjwmPVrsxkTQTrCDvpm7sJ4t5mbAwU9MIiMSwhLDNzSqOB5l8YmFq+OrRPButPBwk66KHVDCTqZZiv+Ny48RQIjULGMGgGQSmYAiwcF5E4XgxxDWVQp8XlUgs7D9c/lY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com.cn; s=zohoarc; t=1546752884; h=Cc:Date:From:In-Reply-To:Message-ID:References:Subject:To:ARC-Authentication-Results; bh=JExTmp1PiSunE4svQlfl9FlaPuH5a8LMw6+vI/nE4Io=; b=QNXsIAnKQcldyfPGQSyCuehyiPhZZleWlftrwMWikPIfDYmyQqPvUkn/B3hsHQMBUpXLrsog91Y6RGbO5iJd8a5R22W8u6HW9O29J4a33dRiavBnu7bchsPiFncQRrES8waWCJbQBc5DvB0dTcqR/j5hf96pwMvf5e0sJ9ISxnc= ARC-Authentication-Results: i=1; mx.zoho.com.cn; dkim=pass header.i=euphon.net; spf=pass smtp.mailfrom=fam@euphon.net; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1546752884; s=zoho; d=euphon.net; i=fam@euphon.net; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; l=5622; bh=JExTmp1PiSunE4svQlfl9FlaPuH5a8LMw6+vI/nE4Io=; b=X1E8y81/SjkfgV8le74Z/0vBgzoqm4UaLK7qrgDeB2rC2DOK9aFcc7FFwYKaghMw UhZK8uBT9WMRSkqvOhq3qzy5/Fw05DhFTQryGVZMQS38YPY+ft+JUpoaAnwUvdW4qYH 259nGRAxQxsgiMmcMi8DOIAsjA2zK6r/bBdaTgPI= Received: from localhost (120.52.147.40 [120.52.147.40]) by mx.zoho.com.cn with SMTPS id 1546752883870214.2197467440826; Sun, 6 Jan 2019 13:34:43 +0800 (CST) From: Fam Zheng To: qemu-devel@nongnu.org Date: Sun, 6 Jan 2019 13:34:09 +0800 Message-Id: <20190106053409.10712-4-fam@euphon.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190106053409.10712-1-fam@euphon.net> References: <20190106053409.10712-1-fam@euphon.net> X-ZohoCNMailClient: External X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 163.53.93.243 Subject: [Qemu-devel] [PULL 3/3] tests: vm: auto_install OpenBSD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Fam Zheng Upgrade OpenBSD to 6.4 using auto_install. Especially, drop SDL1, include SDL2. Also do the build in $HOME since both /var/tmp and /tmp are tmpfs with limited capacities. Signed-off-by: Fam Zheng Message-Id: <20181031025712.18602-1-famz@redhat.com> Signed-off-by: Fam Zheng --- tests/vm/basevm.py | 6 ++-- tests/vm/openbsd | 85 ++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 76 insertions(+), 15 deletions(-) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 5caf77d6b8..6fb446d4c5 100755 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -68,8 +68,6 @@ class BaseVM(object): self._args = [ \ "-nodefaults", "-m", "4G", "-cpu", "max", - "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22", - "-device", "virtio-net-pci,netdev=vnet", "-vnc", "127.0.0.1:0,to=20", "-serial", "file:%s" % os.path.join(self._tmpdir, "serial.out")] if vcpus and vcpus > 1: @@ -146,8 +144,10 @@ class BaseVM(object): "-device", "virtio-blk,drive=%s,serial=%s,bootindex=1" % (name, name)] - def boot(self, img, extra_args=[]): + def boot(self, img, extra_args=[], extra_usernet_args=""): args = self._args + [ + "-netdev", "user,id=vnet,hostfwd=:127.0.0.1:0-:22" + extra_usernet_args, + "-device", "virtio-net-pci,netdev=vnet", "-device", "VGA", "-drive", "file=%s,if=none,id=drive0,cache=writeback" % img, "-device", "virtio-blk,drive=drive0,bootindex=0"] diff --git a/tests/vm/openbsd b/tests/vm/openbsd index cfe0572c59..99a7e98d80 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -14,6 +14,9 @@ import os import sys import subprocess +import time +import atexit +import tempfile import basevm class OpenBSDVM(basevm.BaseVM): @@ -21,25 +24,83 @@ class OpenBSDVM(basevm.BaseVM): arch = "x86_64" BUILD_SCRIPT = """ set -e; - rm -rf /var/tmp/qemu-test.* - cd $(mktemp -d /var/tmp/qemu-test.XXXXXX); + rm -rf $HOME/qemu-test.* + cd $(mktemp -d $HOME/qemu-test.XXXXXX); tar -xf /dev/rsd1c; - ./configure --cc=x86_64-unknown-openbsd6.1-gcc-4.9.4 --python=python2.7 {configure_opts}; + ./configure {configure_opts}; gmake --output-sync -j{jobs} {verbose}; # XXX: "gmake check" seems to always hang or fail #gmake --output-sync -j{jobs} check {verbose}; """ + def _install_os(self, img): + tmpdir = tempfile.mkdtemp() + pxeboot = self._download_with_cache("https://fastly.cdn.openbsd.org/pub/OpenBSD/6.4/amd64/pxeboot", + sha256sum="d87ab39d941ff926d693943a927585945456ccedb76ea504a251b4b93cd4c266") + bsd_rd = self._download_with_cache("https://fastly.cdn.openbsd.org/pub/OpenBSD/6.4/amd64/bsd.rd", + sha256sum="89505c683cbcd75582fe475e847ed53d89e2b8180c3e3d61f4eb4b76b5e11f5c") + install = self._download_with_cache("https://fastly.cdn.openbsd.org/pub/OpenBSD/6.4/amd64/install64.iso", + sha256sum='81833b79e23dc0f961ac5fb34484bca66386deb3181ddb8236870fa4f488cdd2') + subprocess.check_call(["qemu-img", "create", img, "32G"]) + subprocess.check_call(["cp", pxeboot, os.path.join(tmpdir, "auto_install")]) + subprocess.check_call(["cp", bsd_rd, os.path.join(tmpdir, "bsd")]) + + self._gen_install_conf(tmpdir) + # BOOTP filename being auto_install makes sure OpenBSD installer + # not prompt for "auto install mode" + usernet_args = ",tftp=%s,bootfile=/auto_install" % tmpdir + usernet_args += ",tftp-server-name=10.0.2.4" + usernet_args += ",guestfwd=tcp:10.0.2.4:80-cmd:cat %s" % \ + os.path.join(tmpdir, "install.conf") + self.boot(img, + extra_args=["-boot", "once=n", "-no-reboot", + "-cdrom", install], + extra_usernet_args=usernet_args) + self.wait() + + def _gen_install_conf(self, tmpdir): + contents = """\ +HTTP/1.0 200 OK + +System hostname = qemu-openbsd +Password for root = qemupass +Public ssh key for root = {pub_key} +Allow root ssh login = yes +Network interfaces = vio0 +IPv4 address for vio0 = dhcp +Setup a user = qemu +Password for user = qemupass +Public ssh key for user = {pub_key} +What timezone are you in = US/Eastern +Server = fastly.cdn.openbsd.org +Use http = yes +Default IPv4 route = 10.0.2.2 +Location of sets = cd0 +Set name(s) = all +Continue without verification = yes +""".format(pub_key=basevm.SSH_PUB_KEY) + with open(os.path.join(tmpdir, "install.conf"), "w") as f: + f.write(contents) + def build_image(self, img): - cimg = self._download_with_cache("http://download.patchew.org/openbsd-6.1-amd64.img.xz", - sha256sum='8c6cedc483e602cfee5e04f0406c64eb99138495e8ca580bc0293bcf0640c1bf') - img_tmp_xz = img + ".tmp.xz" - img_tmp = img + ".tmp" - subprocess.check_call(["cp", "-f", cimg, img_tmp_xz]) - subprocess.check_call(["xz", "-df", img_tmp_xz]) - if os.path.exists(img): - os.remove(img) - os.rename(img_tmp, img) + + self._install_os(img + ".tmp") + + self.boot(img + ".tmp") + self.wait_ssh() + + self.ssh_root("usermod -G operator qemu") + self.ssh_root("echo https://fastly.cdn.openbsd.org/pub/OpenBSD > /etc/installurl") + for pkg in ["git", "gmake", "glib2", "bison", "sdl2"]: + self.ssh_root("pkg_add " + pkg) + self.ssh_root("ln -sf /usr/local/bin/python2.7 /usr/local/bin/python") + self.ssh_root("ln -sf /usr/local/bin/python2.7-2to3 /usr/local/bin/2to3") + self.ssh_root("ln -sf /usr/local/bin/python2.7-config /usr/local/bin/python-config") + self.ssh_root("ln -sf /usr/local/bin/pydoc2.7 /usr/local/bin/pydoc") + self.ssh_root("shutdown -p now") + self.wait() + + subprocess.check_call(["mv", img + ".tmp", img]) if __name__ == "__main__": sys.exit(basevm.main(OpenBSDVM))