From patchwork Tue Jul 26 09:53:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 9247981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A1F1360757 for ; Tue, 26 Jul 2016 09:53:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9031B20120 for ; Tue, 26 Jul 2016 09:53:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84BAB26C72; Tue, 26 Jul 2016 09:53:50 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.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 00F2F20120 for ; Tue, 26 Jul 2016 09:53:49 +0000 (UTC) Received: from localhost ([::1]:38571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRz3c-0004zf-3H for patchwork-qemu-devel@patchwork.kernel.org; Tue, 26 Jul 2016 05:53:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58010) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRz3K-0004zU-2j for qemu-devel@nongnu.org; Tue, 26 Jul 2016 05:53:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRz3E-0005ce-7N for qemu-devel@nongnu.org; Tue, 26 Jul 2016 05:53:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRz3D-0005cZ-V1 for qemu-devel@nongnu.org; Tue, 26 Jul 2016 05:53:24 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BC1B65725; Tue, 26 Jul 2016 09:53:23 +0000 (UTC) Received: from [10.36.112.46] (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6Q9rK6T010349; Tue, 26 Jul 2016 05:53:21 -0400 To: Thomas Huth , David Gibson References: <1469119676-32373-1-git-send-email-lvivier@redhat.com> <20160722064311.GU15941@voom.fritz.box> <20160723063031.GZ15941@voom.fritz.box> <01797e6a-de08-4073-debe-fab7e4795b80@redhat.com> <8a0c41cc-ed63-befa-f78e-7319b3689655@redhat.com> From: Laurent Vivier Message-ID: <4ab69528-5fe7-1f44-078a-04af2a1985e6@redhat.com> Date: Tue, 26 Jul 2016 11:53:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 26 Jul 2016 09:53:23 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] [PATCH v2] test: port postcopy test to ppc64 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: dgibson@redhat.com, qemu-devel@nongnu.org, dgilbert@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 26/07/2016 11:39, Laurent Vivier wrote: > > > On 26/07/2016 11:28, Thomas Huth wrote: >> On 26.07.2016 11:23, Laurent Vivier wrote: >>> >>> >>> On 23/07/2016 08:30, David Gibson wrote: >>>> On Fri, Jul 22, 2016 at 09:28:58AM +0200, Laurent Vivier wrote: >>>>> >>>>> >>>>> On 22/07/2016 08:43, David Gibson wrote: >>>>>> On Thu, Jul 21, 2016 at 06:47:56PM +0200, Laurent Vivier wrote: >>>>>>> As userfaultfd syscall is available on powerpc, migration >>>>>>> postcopy can be used. >>>>>>> >>>>>>> This patch adds the support needed to test this on powerpc, >>>>>>> instead of using a bootsector to run code to modify memory, >>>>>>> we use a FORTH script in "boot-command" property. >>>>>>> >>>>>>> As spapr machine doesn't support "-prom-env" argument >>>>>>> (the nvram is initialized by SLOF and not by QEMU), >>>>>>> "boot-command" is provided to SLOF via a file mapped nvram >>>>>>> (with "-drive file=...,if=pflash") >>>>>>> >>>>>>> Signed-off-by: Laurent Vivier >>>>>>> --- >>>>>>> v2: move FORTH script directly in sprintf() >>>>>>> use openbios_firmware_abi.h >>>>>>> remove useless "default" case >>>>>>> >>>>>>> tests/Makefile.include | 1 + >>>>>>> tests/postcopy-test.c | 116 +++++++++++++++++++++++++++++++++++++++++-------- >>>>>>> 2 files changed, 98 insertions(+), 19 deletions(-) >>>>>> >>>>>> There's a mostly cosmetic problem with this. If you run make check >>>>>> for a ppc64 target on an x86 machine, you get: >>>>>> >>>>>> GTESTER check-qtest-ppc64 >>>>>> "kvm" accelerator not found. >>>>>> "kvm" accelerator not found. >>>>> >>>>> I think this is because of "-machine accel=kvm:tcg", it tries to use kvm >>>>> and fall back to tcg. >>>>> >>>>> accel.c: >>>>> >>>>> 80 void configure_accelerator(MachineState *ms) >>>>> 81 { >>>>> ... >>>>> 100 acc = accel_find(buf); >>>>> 101 if (!acc) { >>>>> 102 fprintf(stderr, "\"%s\" accelerator not found.\n", buf); >>>>> 103 continue; >>>>> 104 } >>>>> >>>>> We can remove the "-machine" argument to use the default instead (tcg or >>>>> kvm). >>>> >>>> That sounds like a good option for a general test. >>> >>> In fact, we can't: we need to add a "-machine accel=XXXX" to our command >>> line to override the "-machine accel=qtest" provided by the qtest >>> framework. If we don't override it, the machine doesn't start. >> >> Would it work if you'd added some magic with "#ifdef CONFIG_KVM" here? > > I think it needs to be dynamic as the same binary test is used on x86 to > test x86 and ppc64, and vice-versa. I'm going to check if we have > something like "qtest_get_accel()"... Something like that should work: Laurent --- a/tests/postcopy-test.c +++ b/tests/postcopy-test.c @@ -380,12 +380,17 @@ static void test_migrate(void) tmpfs, bootpath, uri); } else if (strcmp(arch, "ppc64") == 0) { init_bootfile_ppc(bootpath); - cmd_src = g_strdup_printf("-machine accel=kvm:tcg -m 256M" +#ifdef _ARCH_PPC64 +#define QEMU_CMD_ACCEL "-machine accel=kvm:tcg" +#else +#define QEMU_CMD_ACCEL "-machine accel=tcg" +#endif + cmd_src = g_strdup_printf(QEMU_CMD_ACCEL " -m 256M" " -name pcsource,debug-threads=on" " -serial file:%s/src_serial" " -drive file=%s,if=pflash,format=raw", tmpfs, bootpath); - cmd_dst = g_strdup_printf("-machine accel=kvm:tcg -m 256M" + cmd_dst = g_strdup_printf(QEMU_CMD_ACCEL " -m 256M" " -name pcdest,debug-threads=on" " -serial file:%s/dest_serial" " -incoming %s",