From patchwork Wed Dec 12 15:22:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726539 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 C8ECF16B1 for ; Wed, 12 Dec 2018 15:27:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B104F2B15D for ; Wed, 12 Dec 2018 15:27:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A560E2B166; Wed, 12 Dec 2018 15:27:11 +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 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 37FA02B15D for ; Wed, 12 Dec 2018 15:27:11 +0000 (UTC) Received: from localhost ([::1]:45574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Pm-0002WH-CX for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:27:10 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MC-0000YJ-Kt for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6M7-0008K6-00 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:28 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:43611) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6M5-0008HA-OT for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:22 -0500 Received: by mail-wr1-x42a.google.com with SMTP id r10so18075317wrs.10 for ; Wed, 12 Dec 2018 07:23:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G2kYVQ6NWFGMBbth0ospSQxYl+nK+fvsyNW7f5/Wduo=; b=SSkEg71JwmUjKvHyqhMIKxzjnUVDeGXwwQz3l7M2c3UvIlIHmIHY/04TyFB/w0b7+s ZjYV59mQVpLnl7p5uWXFxtEqZR6t88Jdi7uq2reB2uQCiOFTjXaE1uD0aClrOHiX0bvi dDqriyek5wrMGbbW7k7LYzXek4oiRuO787s8LV7BP4tl8390qYBuaxqem4bLUc1IyGAK Wh+MXKAAPhK/YPRWs/szkOPS+5M+88OMk0oirwelrNNFsvpCJRoQwVBVa63o244sf1Ym pbUqSPvIuNLvii814uVsWXhCpNd4V1G+7O6FYbpAM776TKHg5sWeG1NvDPcTzpT6/i4V 2SFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=G2kYVQ6NWFGMBbth0ospSQxYl+nK+fvsyNW7f5/Wduo=; b=CMznKOCWKGyNasDHhRBEcs9Pok/NaqvhX9VNqizGsRQymgK3ebCi+aliajc9Q/ZnQX cl8mb5o4up7tUpn2FYFnZK2TXBBF+cxFLbG/AsCqUSAqxC07i9sGafbBQAeXF5DcXVII sZZxRsDbGZQiTwnvVPLZP2IqQwsZ/AkX5PZaRTMjH2UL3SEemnjEtCcRVNYMp/jSeNl3 lznq3L8allA1xh9FwU0uaeWm6Lz46vCQrh8XQ0IA7qaLKte/5iRuhp/kiG4KOkD0+8JL HtUfBDrxPYVzhelOAztEl16cWmvokQvMMlpNyUXxwiUuqdO9iBQ1b+JsFX8jSGuIF1bM CNKg== X-Gm-Message-State: AA+aEWY1rbEAknwoKGNF1ejRx561YifSZ8t12DyuRvb3VGK8PdRP5Vmy uckL52ZrhH6y9FDPlkcnhY4Fm+jM X-Google-Smtp-Source: AFSGD/VLIHVjVVtC4tNKPbovNmwW/kH0TJ6a0WY8ZhTPMeTnKsIQTBIZr7e6Z7K/eTd3AhUCsJYs/g== X-Received: by 2002:a5d:660e:: with SMTP id n14mr17366403wru.19.1544628198449; Wed, 12 Dec 2018 07:23:18 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:17 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:22 +0100 Message-Id: <1544628195-37728-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 01/54] accel: Improve selection of the default accelerator 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth When compiling with "--disable-tcg", we currently still use "tcg" as default accelerator. "kvm" should be used in this case instead. Also, some downstream distros provide QEMU binaries which have "kvm" in their names (e.g. "qemu-kvm" on RHEL or "kvm" on Ubuntu) that use KVM by default - and some users might want to do something similar with upstream binaries, too. Accomodate them by using "kvm:tcg" as default when we detect such a binary name. Signed-off-by: Thomas Huth Message-Id: <1538748792-19444-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- accel/accel.c | 18 +++++++++++++++--- include/sysemu/accel.h | 2 +- vl.c | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/accel/accel.c b/accel/accel.c index 3da26eb..1b1214e 100644 --- a/accel/accel.c +++ b/accel/accel.c @@ -69,7 +69,7 @@ static int accel_init_machine(AccelClass *acc, MachineState *ms) return ret; } -void configure_accelerator(MachineState *ms) +void configure_accelerator(MachineState *ms, const char *progname) { const char *accel; char **accel_list, **tmp; @@ -80,8 +80,20 @@ void configure_accelerator(MachineState *ms) accel = qemu_opt_get(qemu_get_machine_opts(), "accel"); if (accel == NULL) { - /* Use the default "accelerator", tcg */ - accel = "tcg"; + /* Select the default accelerator */ + int pnlen = strlen(progname); + if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) { + /* If the program name ends with "kvm", we prefer KVM */ + accel = "kvm:tcg"; + } else { +#if defined(CONFIG_TCG) + accel = "tcg"; +#elif defined(CONFIG_KVM) + accel = "kvm"; +#else +#error "No default accelerator available" +#endif + } } accel_list = g_strsplit(accel, ":", 0); diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index 637358f..285899e 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -66,7 +66,7 @@ typedef struct AccelClass { extern unsigned long tcg_tb_size; -void configure_accelerator(MachineState *ms); +void configure_accelerator(MachineState *ms, const char *progname); /* Register accelerator specific global properties */ void accel_register_compat_props(AccelState *accel); /* Called just before os_setup_post (ie just before drop OS privs) */ diff --git a/vl.c b/vl.c index a5ae5f2..f6a6193 100644 --- a/vl.c +++ b/vl.c @@ -4308,7 +4308,7 @@ int main(int argc, char **argv, char **envp) qemu_opt_foreach(machine_opts, machine_set_property, current_machine, &error_fatal); - configure_accelerator(current_machine); + configure_accelerator(current_machine, argv[0]); if (!qtest_enabled() && machine_class->deprecation_reason) { error_report("Machine type '%s' is deprecated: %s", From patchwork Wed Dec 12 15:22:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726565 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 39E14174F for ; Wed, 12 Dec 2018 15:34:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 290E22808F for ; Wed, 12 Dec 2018 15:34:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 27AFF29AFF; Wed, 12 Dec 2018 15:34:18 +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 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 B7C342862D for ; Wed, 12 Dec 2018 15:34:17 +0000 (UTC) Received: from localhost ([::1]:45609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6We-0008NZ-RD for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:34:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000q9-AF for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000Ex-Hw for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:36629) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0008I8-4k for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wm1-x32d.google.com with SMTP id a18so6412120wmj.1 for ; Wed, 12 Dec 2018 07:23:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yQy/mbDELZWZv9jD9BKDcjeSRdWab931or41XJjZwBM=; b=Za/+PmH/DmX0jQR2CyLLhNE9HaC/k/1+4PI5b6fvdPAlmsRDNM7gR/T0HynYHARwNK 2dBPCjJu0PlhKzeCzrsaIHbhIMTdLwbBGcFiFCYqCEBaFsFmKrzutIWWjk1ZnV32Ukdl FSUqB5Jr/P0uLksJyuNyQhs82SU6b/l9ESXqXnkO9qQg4CisKYjfW6F7DGaEFKLKLh1K /7xrxPnjaRhFvm8aMn8aq6bpvFtTmGLWz8dIgjtL9wiIDTj6Rn4kP+aIFre1w8834GNu mTu5q4Or3sl8y6Jg2gkij5kwTTPWGwdhqMW7k6iTwdIbmMi7t9ED0VgKPP+RcKr+b4UB +Fpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yQy/mbDELZWZv9jD9BKDcjeSRdWab931or41XJjZwBM=; b=teeCgInw0wKfFutJSBMiJOaLNkvyVo9vAEFeWWs/jUA0+p7scVHpbEETuBKZdlhJKZ Phu3Z26RqpNR9DCudmjvIy7F1JQEIZF8JbNrLhZs8ZrwedCwntw/9u7l67r9BwOiPvYi 0iXa+F1bUdEwpbPXkpBCQbaatcRaI2iPWu1aGxC8gz14sKaLU/KyQRUCCAMruS6Mlr94 Fi7S31lJWuBTlxGy4l7UQEMBgCAqffrafpRcondmBN9Uv3y8RDYf2rIlMkOEzLs8NLyo fMrteahnC7v3wBNBvejJHcfEXPmmrszNOz/maDr1+3Tdg47vA0pa6qRXGetnwUw+buzA YzCQ== X-Gm-Message-State: AA+aEWYd7QStShIXqdegayr8tSh2DNpqymbGFlgC4l6WGabxHqrkufT7 MjeTDQ08GRDPglTpF8VG/3AAuPEv X-Google-Smtp-Source: AFSGD/UY4kMdMbeyW2r2KsiKBToKMNblRqsGoIPW2PEwGCtkcMbWmpDjcYWcfj07THle2S2bn87qFQ== X-Received: by 2002:a1c:58ce:: with SMTP id m197mr7074313wmb.31.1544628200070; Wed, 12 Dec 2018 07:23:20 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:18 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:23 +0100 Message-Id: <1544628195-37728-3-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PULL 02/54] vhost-user-bridge: fix "unknown type name" compilation error 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau osdep.h should be included first: CC tests/vhost-user-bridge.o In file included from /home/elmarco/src/qemu/tests/vhost-user-bridge.c:32: /home/elmarco/src/qemu/include/qemu/atomic.h:480:1: error: unknown type name ‘int64_t’ int64_t atomic_read_i64(const int64_t *ptr); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:480:32: error: unknown type name ‘int64_t’ int64_t atomic_read_i64(const int64_t *ptr); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:481:1: error: unknown type name ‘uint64_t’ uint64_t atomic_read_u64(const uint64_t *ptr); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:481:32: error: unknown type name ‘uint64_t’ uint64_t atomic_read_u64(const uint64_t *ptr); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:482:21: error: unknown type name ‘int64_t’ void atomic_set_i64(int64_t *ptr, int64_t val); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:482:35: error: unknown type name ‘int64_t’ void atomic_set_i64(int64_t *ptr, int64_t val); ^~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:483:21: error: unknown type name ‘uint64_t’ void atomic_set_u64(uint64_t *ptr, uint64_t val); ^~~~~~~~ /home/elmarco/src/qemu/include/qemu/atomic.h:483:36: error: unknown type name ‘uint64_t’ void atomic_set_u64(uint64_t *ptr, uint64_t val); ^~~~~~~~ (regression from 782da5b2921c4d18777d5d5bd9385b9f7beae360) Signed-off-by: Marc-André Lureau Message-Id: <20181031104136.9953-1-marcandre.lureau@redhat.com> Reviewed-by: Michal Privoznik Reviewed-by: Emilio G. Cota Signed-off-by: Paolo Bonzini --- tests/vhost-user-bridge.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/vhost-user-bridge.c b/tests/vhost-user-bridge.c index 0cf8d0b..e029e5b 100644 --- a/tests/vhost-user-bridge.c +++ b/tests/vhost-user-bridge.c @@ -29,8 +29,9 @@ #define _FILE_OFFSET_BITS 64 -#include "qemu/atomic.h" #include "qemu/osdep.h" + +#include "qemu/atomic.h" #include "qemu/iov.h" #include "standard-headers/linux/virtio_net.h" #include "contrib/libvhost-user/libvhost-user.h" From patchwork Wed Dec 12 15:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726567 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 E1C3D174F for ; Wed, 12 Dec 2018 15:34:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D28B3285C9 for ; Wed, 12 Dec 2018 15:34:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C74402B1CC; Wed, 12 Dec 2018 15:34:32 +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 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 AF0EC285C9 for ; Wed, 12 Dec 2018 15:34:31 +0000 (UTC) Received: from localhost ([::1]:45615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ws-0001fD-N5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:34:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MW-0000lG-Bw for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MU-0000C0-De for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:36633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MS-0008JB-GF for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:45 -0500 Received: by mail-wm1-x331.google.com with SMTP id a18so6412214wmj.1 for ; Wed, 12 Dec 2018 07:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ctRbsjwq3h8bFqRfd6s2LOcH6gg+c6ZIouWMyTb2n+k=; b=aUNJe0tztt+Xu2YfrQQd2WBA5nmulvJjTx2R9Rh/hYbKPVJ8v8ExstopXJf8aiRGSF /nCZCC5KxxRdPMZKrj7xJzOkQcQsqxwjWjiRFIsy/u8gctpa+Bz7EBgfRdBQxRdHYo0G Wkv0AGVqW6N2DFqC8yi+5zS13aN4bAgZbeOkozNO7PG0LASdJKCj7wiQJcwZ1XG12eBR 4LQ/knQLNrUV/QMaDmFhCmEKV4doxSOORhy7N0bx8ho0BI/A9+RZKngh7rvgMyoogcRy 2C6ScuUUeWuP6skjXlbcLeeIkdsU041sFhfVuXVG+zKd5jZrJI0SsvqZk6bJb3+YU5UW tZxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=ctRbsjwq3h8bFqRfd6s2LOcH6gg+c6ZIouWMyTb2n+k=; b=hx9CR4kf25QnuYw4i51POCcD+VCU8Fn++gD7hY0YGY82BykDBNttRygn1Wrbf5X0eg 2d2R2ocjfN+g6miIa5kcRGSh9rcALtNDrWe3lN8MWj19RzQRMPrDVAL+bBdeqv+SHkun eht0jrg4DHIER1Uq0PeTk7ktH23laemT+umeMR9g2K6/RivKiriIOktR8SYZin+xd7qw aypnRNqEED9K/D2cU8yozZ0/6NzJC32lf6gSkLdrz2I8BrF1e7lOAtjxjxQlkgtVDlxC yKCjrFMYMcO4dOuGCXAMTDOr40rdegqjBjD8TWRNyvb8WCZ34Rf3nXddYuSNWWhX1Opa iNwA== X-Gm-Message-State: AA+aEWZr7SHWZL+8N+gMvk4V9IrC4ezTijFlXqESrfB5BbbK2Mq2c1fR LtAJmvMdhyCiolT2xWFuZoug7ag+ X-Google-Smtp-Source: AFSGD/US12cDcthGVbUGLed0abkDAm65I0QnkTFBiZGd7VYSOiHuRD6lV9Pnp9eACvv5HDRGHtVndw== X-Received: by 2002:a1c:8d12:: with SMTP id p18mr7282941wmd.31.1544628201625; Wed, 12 Dec 2018 07:23:21 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:20 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:24 +0100 Message-Id: <1544628195-37728-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::331 Subject: [Qemu-devel] [PULL 03/54] checkpatch: fix premature exit when no input or --mailback 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP In some cases, checkpatch's process subroutine is exiting the whole process. This is wrong, just return from the subroutine instead. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 60f6f89..b9974f0 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2820,19 +2820,19 @@ sub process { # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { - exit(0); + return 1; } # In mailback mode only produce a report in the negative, for # things that appear to be patches. if ($mailback && ($clean == 1 || !$is_patch)) { - exit(0); + return 1; } # This is not a patch, and we are are in 'no-patch' mode so # just keep quiet. if (!$chk_patch && !$is_patch) { - exit(0); + return 1; } if (!$is_patch) { From patchwork Wed Dec 12 15:22:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726533 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 27B6A1751 for ; Wed, 12 Dec 2018 15:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 144A62B148 for ; Wed, 12 Dec 2018 15:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0382F2B164; Wed, 12 Dec 2018 15:25:14 +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 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 373D82B148 for ; Wed, 12 Dec 2018 15:25:13 +0000 (UTC) Received: from localhost ([::1]:45561 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ns-0000hN-BJ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:25:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MO-0000f6-FA for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MH-0008TV-4P for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:42670) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MG-0008KO-Pb for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:32 -0500 Received: by mail-wr1-x436.google.com with SMTP id q18so18081052wrx.9 for ; Wed, 12 Dec 2018 07:23:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vm2wjzXkL5PP2aLDyrYYWyhFBlLf24Lfzqe9tNyyfE4=; b=IXVLmXWrwmozDWBkuPPjrGJSv5t3kFVEmroi+JTRMs/39I3gIVyIdCuICYwrjy9ZpF ld9DHE6E5hZuUx+eGY2ntptSh2XmXVl36rnGJZFWcKP5wMUc0Q+RRHPFZLDnNn1VlQ5V qVR5ZRuAhXOUZ10CRGnWLST4O56/qaOXWeNkgcr7t6iqKEDTnUru69T6WQl6MyFDmLfv sV9EqaIjB0GWJAKo4WAMMiro2ipFxHpCbB0HWw8mDm8+QRGpFPIt1yf+yolw8kkv61Qy 7LfzlZq3XQ9kVTPdx4erTqFnJ4riGnRt1+eTGg7+e4XCsMmQ+Qpt0/c71sf7jwhiuAlB owOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Vm2wjzXkL5PP2aLDyrYYWyhFBlLf24Lfzqe9tNyyfE4=; b=unebTDFUpuVU7ypOuTpSXFQBLGvna86sPMCYlJ3ftA4/grp9bR0p2EFNh+xncb1L1K PmcqDrChurLQxZqC41gqY4ORzsGJoU4LM3srM36dLYeDL8zIetzJZvHNbydePyLWKiTa VDxmvttin8ClgyYplFnXOzO8mxETSRZsKLudimvHDYe4ashhIaBkdZ25XM6hbMQE92AV 2W95Ay4hxFujKCuX6euHgrpKTS3GdIYUMGvUjxM/DsT4ZBtJNpbjxpj48D5oCSf3Hs3E fFQmLR/oW/Lu2EVevDXH7ZSFTBI8nkIdIZEE0m2s5Zq7D0B227UE89R0rFjIX0dxxqQx e96g== X-Gm-Message-State: AA+aEWYV9j7l+0rUzZtkZP0xzodcwXbcPpsYKX2daDZGxwjFFgJcJETV 6yDiJ1TjTVkdEeZlaohM8yAufYir X-Google-Smtp-Source: AFSGD/UQkynO4SMRF/0AjU5+LwlQ7eDJKNhjZV/0X9da3+vmihdD47vaKqfcyEoSBdsc6h8oGtPiLQ== X-Received: by 2002:adf:9061:: with SMTP id h88mr17413797wrh.65.1544628202629; Wed, 12 Dec 2018 07:23:22 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:21 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:25 +0100 Message-Id: <1544628195-37728-5-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 Subject: [Qemu-devel] [PULL 04/54] checkpatch: check Signed-off-by in --mailback mode 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Pull the test before the anticipated exits from the process sub. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b9974f0..506aa6c 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2817,6 +2817,10 @@ sub process { } } + if ($is_patch && $chk_signoff && $signoff == 0) { + ERROR("Missing Signed-off-by: line(s)\n"); + } + # If we have no input at all, then there is nothing to report on # so just keep quiet. if ($#rawlines == -1) { @@ -2838,9 +2842,6 @@ sub process { if (!$is_patch) { ERROR("Does not appear to be a unified-diff format patch\n"); } - if ($is_patch && $chk_signoff && $signoff == 0) { - ERROR("Missing Signed-off-by: line(s)\n"); - } print report_dump(); if ($summary && !($clean == 1 && $quiet == 1)) { From patchwork Wed Dec 12 15:22:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726553 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 F3FA11751 for ; Wed, 12 Dec 2018 15:29:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E34872A50D for ; Wed, 12 Dec 2018 15:29:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D662A2A554; Wed, 12 Dec 2018 15:29:58 +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 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 66E422A50D for ; Wed, 12 Dec 2018 15:29:58 +0000 (UTC) Received: from localhost ([::1]:45595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ST-0006Li-AP for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:29:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MR-0000hG-3q for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MO-00007S-Hh for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:42 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:42440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MK-0008L9-PW for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: by mail-wr1-x443.google.com with SMTP id q18so18081112wrx.9 for ; Wed, 12 Dec 2018 07:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=PDjUEFHL/ho8c/m4r+hfYPSP5W70O1tCjmOSIOtYvbY=; b=jTqy6EBXjaE9GU0qy4WYLQOsSfGf1G0+mKFpcSPimoBb7s0D7Rvq0dPiqpAjS7EL82 Ib4Ga3f/D7Le7Yhz6Vqz/djlK3ggOv4hiFOul20iTzPvn+H6zvecJ5N4LOxPJNBKT0Sd DcgHItdcwMtHp7qHjK1tk65Iw9UaHvWZvsD2Ka1LouYIIVDmlNSTwK3ZfbnG4QW4jtmO Y9ABucKnIeaShptCRykbaGD9s0FPbSizQ7lsR1dHwXTv0yijVq7UnB0l5Tfyjv/I2Gbe aA9qaJesmSn8VNbbtMbefMbuxHazkdEo/9Lbxp1Uc3OuF4PF8Hb/F2vDnM3Cch1yOzWm njXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=PDjUEFHL/ho8c/m4r+hfYPSP5W70O1tCjmOSIOtYvbY=; b=HW3ylhE6v8MJ6xzaSPIzPH6GklH680NTti0pTDywTVzmS3E2SCdPWpavEhbCp4HofO 9hZ6kf5cOeXqpudMnx+73RHkQwz4xj8wsyaIibVru9SB8EIPF1+FGwAu+vmw/LN7k7u7 Zo5Zk+GzhHHwEJYHbFPxniXn8ugW+x0cAbsZqiY/osKVTMILszOkSk2FJNpheMIIrV3T dOr8i4/eA9nXh++Gg2MpMN1mQOizgZLJwYb9olshccJJUPUcZgE25r/n2bWKe9g+3iyB HwJB616rOOBsMgGjqR3C+A7VnGx7N3VAwBPzhuhTOlSFyl2hwFAmOf4F6d1hwJYRuIaQ qh+Q== X-Gm-Message-State: AA+aEWZztsCLmkDIbXEvqVzQut+1dW2HKJMQyGH3vDT+L7OUBygQNTp+ PM5OK2NylKEwxc0Izi8tU5kcc094 X-Google-Smtp-Source: AFSGD/V8sOMe4xgQaoXWSidlXpTM55+U5j4u6bmmqsHDztqn9io0JaDR9IyMCX9W+ZS3wFO+yE61ww== X-Received: by 2002:adf:e08c:: with SMTP id c12mr16684539wri.199.1544628203525; Wed, 12 Dec 2018 07:23:23 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:22 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:26 +0100 Message-Id: <1544628195-37728-6-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PULL 05/54] checkpatch: improve handling of multiple patches or files 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Similar to how patchew output looks like for multiple patches, say what file or patch is being tested _before_ emitting errors. This is clearer to a human that scans the output from top to bottom. In addition, provide a truncated commit hash and subject instead of the full hash, and process the commits first-to-last rather than last-to-first. Inspired by Linux commit 0dea9f1eef86bedacad91b6f652ca1ab0d08854c ("checkpatch: reduce number of `git log` calls with --git", 2016-03-20). Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 506aa6c..2edb4e2 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -340,13 +340,18 @@ my @lines = (); my $vname; if ($chk_branch) { my @patches; + my %git_commits = (); my $HASH; - open($HASH, "-|", "git", "log", "--format=%H", $ARGV[0]) || - die "$P: git log --format=%H $ARGV[0] failed - $!\n"; - - while (<$HASH>) { - chomp; - push @patches, $_; + open($HASH, "-|", "git", "log", "--reverse", "--no-merges", "--format=%H %s", $ARGV[0]) || + die "$P: git log --reverse --no-merges --format='%H %s' $ARGV[0] failed - $!\n"; + + for my $line (<$HASH>) { + $line =~ /^([0-9a-fA-F]{40,40}) (.*)$/; + next if (!defined($1) || !defined($2)); + my $sha1 = $1; + my $subject = $2; + push(@patches, $sha1); + $git_commits{$sha1} = $subject; } close $HASH; @@ -354,21 +359,31 @@ if ($chk_branch) { die "$P: no revisions returned for revlist '$chk_branch'\n" unless @patches; + my $i = 1; + my $num_patches = @patches; for my $hash (@patches) { my $FILE; open($FILE, '-|', "git", "show", $hash) || die "$P: git show $hash - $!\n"; - $vname = $hash; while (<$FILE>) { chomp; push(@rawlines, $_); } close($FILE); + $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; + if ($num_patches > 1 && $quiet == 0) { + print "$i/$num_patches Checking commit $vname\n"; + $vname = "Patch $i/$num_patches"; + } else { + $vname = "Commit " . $vname; + } if (!process($hash)) { $exit = 1; + print "\n" if ($num_patches > 1 && $quiet == 0); } @rawlines = (); @lines = (); + $i++; } } else { for my $filename (@ARGV) { @@ -387,6 +402,7 @@ if ($chk_branch) { } else { $vname = $filename; } + print "Checking $filename...\n" if @ARGV > 1 && $quiet == 0; while (<$FILE>) { chomp; push(@rawlines, $_); From patchwork Wed Dec 12 15:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726563 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 72C4F16B1 for ; Wed, 12 Dec 2018 15:34:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 636C428635 for ; Wed, 12 Dec 2018 15:34:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 61C6E2B1AE; Wed, 12 Dec 2018 15:34:17 +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 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 D003428938 for ; Wed, 12 Dec 2018 15:34:16 +0000 (UTC) Received: from localhost ([::1]:45608 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Wd-0008N0-Jr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:34:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MX-0000mJ-Hv for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MW-0000DA-DB for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:55392) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MU-0008Lx-Ip for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: by mail-wm1-x334.google.com with SMTP id y139so6132166wmc.5 for ; Wed, 12 Dec 2018 07:23:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jkiJU8pzboGzQe6MMzZPXG/hBj0o/LdIbK/KigkNsKo=; b=D9+Yr8IkuF0ieinCpttMPbZ7ix9o1Plv74zdsKoGItZRoQOLbBdm6EYXW2BAzg8f2E kw3HwdexrifYTs6/BwPpHrcw8G0LvbqYHwJQ9EoCSP27/wSsKwEHg+4FwQaxyqslAqlS 41+qo6qjyg/qcdkUaZcN7uFx9Sd8wp7NhznKiO0PuTjGZ/+Xgk/Eht5YKpWwOvXqA5cp st0Yfu3h4bE9IwCwzzvg8uzOp483mgQTW7CFqYhr2Ohsh6nlimFUf+XUPy2MWbaPzmxK wHNr14uZf6rt77GHGLefMDyp+OHT3vPZvO9QbqsXUibkmSEYbjg9P2PrwwBi6iBHQtRk hhPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=jkiJU8pzboGzQe6MMzZPXG/hBj0o/LdIbK/KigkNsKo=; b=GO91qkG6c8uA7of92A5O05FmF8HI9x1xjWZCV3oZVnmBEqMMpf48y3bfVQnuy8kqj6 48dePR/beA40GjG/VAgSvZ/iykI6rQV6tKcKQS3aaThK5E/ib8f6loT24dKDQ8ep/MPQ Uzv7wTwT5moXPbxq45mjgxeagsS4COgnNlSqFRVzlaSQI3JsX15UNWraz04EsqjCdNEP xODXZprvuUdsH4xd/SM3GqE58svsbsSKe5etGHExQG/08RuGb1lDVlCCedegmFlZWdSq 9gL5NWI6otCqRj/qgV//M6lqMRSw2v+aMu0VDhE1aw2wlPwJIkfDM3NOy098hiJlPHpy pRUw== X-Gm-Message-State: AA+aEWaJuYPL/+5iEDdEaxN1He8YIunnB+P0hnbCrUkCeBhq/T1JE+p5 BVB9NArJlKYkSY6TEaxe5UbXgY81 X-Google-Smtp-Source: AFSGD/UhOq3fqgNG/BC/1tri+Z6dH5+5EgCg2itpR5ZKGfzEMiKPTVIwHkDFgAM2LafHQOJpFJMqpA== X-Received: by 2002:a7b:cc86:: with SMTP id p6mr710626wma.19.1544628205103; Wed, 12 Dec 2018 07:23:25 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:23 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:27 +0100 Message-Id: <1544628195-37728-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 06/54] checkpatch: colorize output to terminal 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add optional colors to make seeing message types a bit easier. The default is to show them on a tty. Inspired by Linux commits 57230297116fa ("checkpatch: colorize output to terminal") and 737c0767758b ("checkpatch: change format of --color argument to --color[=WHEN]"). Signed-off-by: Paolo Bonzini Reviewed-by: Philippe Mathieu-Daudé --- scripts/checkpatch.pl | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2edb4e2..a8d6e44 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -7,6 +7,7 @@ use strict; use warnings; +use Term::ANSIColor qw(:constants); my $P = $0; $P =~ s@.*/@@g; @@ -26,6 +27,7 @@ my $tst_only; my $emacs = 0; my $terse = 0; my $file = undef; +my $color = "auto"; my $no_warnings = 0; my $summary = 1; my $mailback = 0; @@ -64,6 +66,8 @@ Options: is all off) --test-only=WORD report only warnings/errors containing WORD literally + --color[=WHEN] Use colors 'always', 'never', or only when output + is a terminal ('auto'). Default is 'auto'. -h, --help, --version display this help and exit When FILE is - read standard input. @@ -72,6 +76,14 @@ EOM exit($exitcode); } +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + GetOptions( 'q|quiet+' => \$quiet, 'tree!' => \$tree, @@ -89,6 +101,8 @@ GetOptions( 'debug=s' => \%debug, 'test-only=s' => \$tst_only, + 'color=s' => \$color, + 'no-color' => sub { $color = 'never'; }, 'h|help' => \$help, 'version' => \$help ) or help(1); @@ -144,6 +158,16 @@ if (!$chk_patch && !$chk_branch && !$file) { die "One of --file, --branch, --patch is required\n"; } +if ($color =~ /^always$/i) { + $color = 1; +} elsif ($color =~ /^never$/i) { + $color = 0; +} elsif ($color =~ /^auto$/i) { + $color = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + my $dbg_values = 0; my $dbg_possible = 0; my $dbg_type = 0; @@ -372,7 +396,9 @@ if ($chk_branch) { close($FILE); $vname = substr($hash, 0, 12) . ' (' . $git_commits{$hash} . ')'; if ($num_patches > 1 && $quiet == 0) { - print "$i/$num_patches Checking commit $vname\n"; + my $prefix = "$i/$num_patches"; + $prefix = BLUE . BOLD . $prefix . RESET if $color; + print "$prefix Checking commit $vname\n"; $vname = "Patch $i/$num_patches"; } else { $vname = "Commit " . $vname; @@ -1182,14 +1208,23 @@ sub possible { my $prefix = ''; sub report { - if (defined $tst_only && $_[0] !~ /\Q$tst_only\E/) { + my ($level, $msg) = @_; + if (defined $tst_only && $msg !~ /\Q$tst_only\E/) { return 0; } - my $line = $prefix . $_[0]; - $line = (split('\n', $line))[0] . "\n" if ($terse); + my $output = ''; + $output .= BOLD if $color; + $output .= $prefix; + $output .= RED if $color && $level eq 'ERROR'; + $output .= MAGENTA if $color && $level eq 'WARNING'; + $output .= $level . ':'; + $output .= RESET if $color; + $output .= ' ' . $msg . "\n"; + + $output = (split('\n', $output))[0] . "\n" if ($terse); - push(our @report, $line); + push(our @report, $output); return 1; } @@ -1197,13 +1232,13 @@ sub report_dump { our @report; } sub ERROR { - if (report("ERROR: $_[0]\n")) { + if (report("ERROR", $_[0])) { our $clean = 0; our $cnt_error++; } } sub WARN { - if (report("WARNING: $_[0]\n")) { + if (report("WARNING", $_[0])) { our $clean = 0; our $cnt_warn++; } From patchwork Wed Dec 12 15:22:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726547 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 EEB521759 for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0A232B148 for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D53932B173; Wed, 12 Dec 2018 15:28:07 +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 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 8FEEB2B15D for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: from localhost ([::1]:45580 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Qg-0003IX-Pa for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:28:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MY-0000mo-1v for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MW-0000Dd-P7 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:41231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MW-0008Np-Dz for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: by mail-wr1-x434.google.com with SMTP id x10so18065819wrs.8 for ; Wed, 12 Dec 2018 07:23:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=3xM33VS0oaeUNpQ/zLxz2boWlxey5u3x1AFXYpiDEOg=; b=RIAWkHOiNMvLY4t/b7O7UyCngGZFBQbW9vMHLuM6nQHYgPn78Jr4T9930fnmNYwZos mBUZ7I8CQ1v9gPQ5REDjNsZriUYuH4E2FbDAJrrsfx1p0mYT7Oj9a7I1h3PE91CwF9AK +ZuxSNn+L1O65zECpJwEUD3K3mzN63s+jwAGkcE3jlM57y2thVNOtUHisb6xEaGmnEKa xzeN4tie/CVABXvFMBUU1OhuHZ99B31cvMl8WGk23mbrxODwOk6jluBTy6853HM7EE81 YJVk7Jr0tCuQMRFgXVU1FIVi8qyl5cVYplKJ44tUpfvyzA0v46uBbCNroAgpRwQhVGsQ dalA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=3xM33VS0oaeUNpQ/zLxz2boWlxey5u3x1AFXYpiDEOg=; b=XKbPd4TQlCzm98G4faVL5pa9s67PvsQFsAV4fEDn+YbVNG4MZ2ldIotdRBOdXwkGT8 IjHrzyQCl7ig6cL+g4f3GosqjKxO+bmUUIC8OmE2LkIieSCfIkDyjrz+UFPHHzWyB/DA j9TLp1BZKk+vQiLy8ea3lFMCAWp0umxLzj+Swf9oK9i5JuNSXx0/hEGBg9H36vd1o+FM 3JgpfUkaEfvs5Ts72koi9jVPfKRw69WSNgEAMpTk5Su8AzzyRcb3E/KC+rANSZTR6Jkz dNq+gBYup8YWtbcWvnJli/o6/YTv+xcU98WT/eNCdLK9sRmEc7D2VL0hgDDul7VyHvKf HcyA== X-Gm-Message-State: AA+aEWaBh8CP5xOoFm86mg7lblnMX9/b/+5QDqm9ofEgaWZPu5zGs1zr AXaU5o5UDiEnqJCE3MYxuvdqLro1 X-Google-Smtp-Source: AFSGD/VhexQ7aj1W4IoedzzpOJsiYkUqea90Xd/AXHfad5fpEO46k1E1vGRiDcY2ZACgY/TvsYg5NQ== X-Received: by 2002:adf:fbc8:: with SMTP id d8mr16412752wrs.318.1544628207012; Wed, 12 Dec 2018 07:23:27 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.25 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:25 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:28 +0100 Message-Id: <1544628195-37728-8-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 Subject: [Qemu-devel] [PULL 07/54] pam: wrap MemoryRegion initialization in a transaction 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This avoids a few re-rendering of the memory AddressSpace. Signed-off-by: Paolo Bonzini --- hw/pci-host/pam.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/pci-host/pam.c b/hw/pci-host/pam.c index e361ecb..aa5ecfd 100644 --- a/hw/pci-host/pam.c +++ b/hw/pci-host/pam.c @@ -52,11 +52,13 @@ void init_pam(DeviceState *dev, MemoryRegion *ram_memory, memory_region_init_alias(&mem->alias[2], OBJECT(dev), "pam-pci", ram_memory, start, size); + memory_region_transaction_begin(); for (i = 0; i < 4; ++i) { memory_region_set_enabled(&mem->alias[i], false); memory_region_add_subregion_overlap(system_memory, start, &mem->alias[i], 1); } + memory_region_transaction_commit(); mem->current = 0; } From patchwork Wed Dec 12 15:22:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726559 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 AADA316B1 for ; Wed, 12 Dec 2018 15:31:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97B732AB26 for ; Wed, 12 Dec 2018 15:31:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 888532AC29; Wed, 12 Dec 2018 15:31:15 +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 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 2B8112AB26 for ; Wed, 12 Dec 2018 15:31:15 +0000 (UTC) Received: from localhost ([::1]:45603 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ti-0007Mg-9r for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:31:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52089) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MR-0000hF-3o for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MO-00007Y-I8 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:42 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:55386) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MK-0008OL-Op for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: by mail-wm1-x32d.google.com with SMTP id y139so6132306wmc.5 for ; Wed, 12 Dec 2018 07:23:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=J2D6lcwPWcdNjYAiutJXEhmrCqM8BF8vw582jFL8R7k=; b=nX6KtpyCAEO1L8MQ1mwQXld5iFBiWodKKoBUbrVtgM7se33gZCnKf75p8pNk854Z2H lTEhySRqP/ZxEAXCaR9sgmxwtwZGUN2JqqCQ1CFic/rZLYoY8gpF36XCL1knrjaDdmCM VloB+0QfBRogEHU2EbziEs5gHOtRNnpCXB37ewv14vHyBD+XCFqOoZ8ckl4psfAa/GFI ig5418iWAEFjAZZaAoMiJiXEO0j8mITL65Arc1R0CLCQhqUcHcALCRla7g1tDuXQBIdR W84IJ3uJBKzy7tx0hH2+AO9sEX5+FkYnfPN9mhmJB//B+EK4wwUbkMKGFTwAW3Z5i7uM VWew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=J2D6lcwPWcdNjYAiutJXEhmrCqM8BF8vw582jFL8R7k=; b=C5L7uRMUWlx6a5tdtY+Q6hiWchvLpUA1S/gOAD4UAXko/Adze/hIczFly2yJBumDte Hg0YZuCa+pxuAdq2jo2OVvB9fb9W5nEsw+ZUGry9DjQOjhbBqS6wlCk9IhXp3ZIoXwR6 N0xmkbfNoxzbnrjtEqYX6bhIrwJ+8eeCamKCk5IiCkiFHXRmQasf5q/RYLn5D5eT/d1z HLC2vPZGmRfSHBZ8ewBxUc+xWgXHF4FNjRjKE4LWYDxaC68vNjbGHg1qyZQtrTxFstiW u14FsmdkZa1CtyyKeRIl4SNmxDFYIHL5lXt0BbsNAe89alZwx9iATdV8XJOecR0XwkrR IL0w== X-Gm-Message-State: AA+aEWbRYfg9U01K8Xb1y6fYOF9DKQFGIbQNUEC3Hu7jrqF+Ze/q49bA BIUidK4lQRGslGt81fb6NQfiBjlj X-Google-Smtp-Source: AFSGD/VSVR5M2x49uQKWb3a1NOLdrXml7/bAdY9rzuZcczHnYlOFyoa4+Mxckh52zL4cmpoYTOglQQ== X-Received: by 2002:a1c:8acf:: with SMTP id m198mr7140278wmd.143.1544628207913; Wed, 12 Dec 2018 07:23:27 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:27 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:29 +0100 Message-Id: <1544628195-37728-9-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PULL 08/54] memory: extract flat_range_coalesced_io_{del, add} 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Extract two new functions from memory_region_update_coalesced_range_as. To avoid duplication in the creation of the MemoryRegionSection, use MEMORY_LISTENER_UPDATE_REGION instead of MEMORY_LISTENER_CALL to invoke the listener callback. Signed-off-by: Paolo Bonzini --- memory.c | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/memory.c b/memory.c index d14c6de..119b6e4 100644 --- a/memory.c +++ b/memory.c @@ -850,6 +850,33 @@ static void address_space_update_ioeventfds(AddressSpace *as) flatview_unref(view); } +static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) +{ + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, + int128_get64(fr->addr.start), + int128_get64(fr->addr.size)); +} + +static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) +{ + MemoryRegion *mr = fr->mr; + CoalescedMemoryRange *cmr; + AddrRange tmp; + + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { + tmp = addrrange_shift(cmr->addr, + int128_sub(fr->addr.start, + int128_make64(fr->offset_in_region))); + if (!addrrange_intersects(tmp, fr->addr)) { + continue; + } + tmp = addrrange_intersection(tmp, fr->addr); + MEMORY_LISTENER_UPDATE_REGION(fr, as, Forward, coalesced_io_add, + int128_get64(tmp.start), + int128_get64(tmp.size)); + } +} + static void address_space_update_topology_pass(AddressSpace *as, const FlatView *old_view, const FlatView *new_view, @@ -2136,34 +2163,12 @@ static void memory_region_update_coalesced_range_as(MemoryRegion *mr, AddressSpa { FlatView *view; FlatRange *fr; - CoalescedMemoryRange *cmr; - AddrRange tmp; - MemoryRegionSection section; view = address_space_get_flatview(as); FOR_EACH_FLAT_RANGE(fr, view) { if (fr->mr == mr) { - section = (MemoryRegionSection) { - .fv = view, - .offset_within_address_space = int128_get64(fr->addr.start), - .size = fr->addr.size, - }; - - MEMORY_LISTENER_CALL(as, coalesced_io_del, Reverse, §ion, - int128_get64(fr->addr.start), - int128_get64(fr->addr.size)); - QTAILQ_FOREACH(cmr, &mr->coalesced, link) { - tmp = addrrange_shift(cmr->addr, - int128_sub(fr->addr.start, - int128_make64(fr->offset_in_region))); - if (!addrrange_intersects(tmp, fr->addr)) { - continue; - } - tmp = addrrange_intersection(tmp, fr->addr); - MEMORY_LISTENER_CALL(as, coalesced_io_add, Forward, §ion, - int128_get64(tmp.start), - int128_get64(tmp.size)); - } + flat_range_coalesced_io_del(fr, as); + flat_range_coalesced_io_add(fr, as); } } flatview_unref(view); From patchwork Wed Dec 12 15:22:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726537 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 C57AE16B1 for ; Wed, 12 Dec 2018 15:25:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B624E2B148 for ; Wed, 12 Dec 2018 15:25:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA7162B164; Wed, 12 Dec 2018 15:25:28 +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 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 59CE62B148 for ; Wed, 12 Dec 2018 15:25:28 +0000 (UTC) Received: from localhost ([::1]:45572 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6O7-0002J2-Fv for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:25:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52039) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MO-0000f5-Es for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MI-0008V7-Qu for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:46520) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MG-0008Qh-Us for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:33 -0500 Received: by mail-wr1-x42a.google.com with SMTP id l9so18047166wrt.13 for ; Wed, 12 Dec 2018 07:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=ohNPlITjNo9ZpAsml58lXHZNCGfnAWqPmz2U8SwFAFA=; b=OgbguIwUiLniqEpRGDAzHiI2vDStkWPGROpXrMkXgX8zFdWT3S67BOiYAUlgLrIkTo RxYx36/S1f7LJTwoqbL6fazLon4ShZVF86wuXrHREjI+MDT0duqT9vY16SOIojTcwae7 sudwzn0yPbrT4ZXIiAamfrRjUK2JaQ+6C0rqPWZZESgDM/B6V7VjRQW+1J3fhcGUzQVw dzzkXH0pYNhdjGUcdcmQJarrm0G+b/SUiRAf+5rTCKhJ+htC6hdBtwC7X0qxV84sg6xd 3mZHeUDETKpm0et7Qt7Xh9UKYm4dO0dc4mSmdM0ZNbohW+sG0w1pljZSgIik5auOJUve f+Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=ohNPlITjNo9ZpAsml58lXHZNCGfnAWqPmz2U8SwFAFA=; b=DXZsEsFq0btG7fMcbkKJBVPRaWoFFn2Qwy5QVpliCRdlIeIgR1gVGROEXi6Op8mRhY 4HWGLytuDx8o4472V8FrzcqeDnoaVoHCzY8ofmlFnmKrOH30WZwP0VlTSdu3UN9+P3Md 0RnexWnK/kjJVJoisUtSP8bxmhc/7cz7DqZUYUQzaHtwdowmHTPk6HDrrDoqFGyZ3YPw 1gmSwbpkeE2pYj7ofXO2pIZgqUIFF9PoObKeD10HFQ61JWPwup0v60JBCGyaD8hVN9tI +6oKJshYjsJwd+Bq4uZj11mQ9yLIS5xAnzji4czR985wI4B7/BKeTLK4Dq9udq+CEFqt yQTQ== X-Gm-Message-State: AA+aEWaCdabsd8oaerzCMwGb/LrkTkleI04t+GBwle9JFoOr6hFrJEHj vTk03vl/6QKekzY7T1+Lu/PGkbdz X-Google-Smtp-Source: AFSGD/XrMxyyu3m3YE4UtDNb4toJE5NvgTmoyCMS8KFe59th4w1kTtpVJnEHR5+P96ao4SDvhCMseQ== X-Received: by 2002:adf:fe43:: with SMTP id m3mr17056367wrs.290.1544628209495; Wed, 12 Dec 2018 07:23:29 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:28 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:30 +0100 Message-Id: <1544628195-37728-10-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 09/54] memory: avoid unnecessary coalesced_io_del operations 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Store whether the FlatRange has had any coalesced I/O ranges applied, and if not avoid calling coalesced_io_del. This is useful in preparation for the next patch, which will call coalesced_io_del when rendering memory regions. Signed-off-by: Paolo Bonzini --- memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/memory.c b/memory.c index 119b6e4..072769a 100644 --- a/memory.c +++ b/memory.c @@ -217,6 +217,7 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; + bool has_coalesced_range; }; #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -650,6 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; + fr.has_coalesced_range = false; /* Render the region itself into any gaps left by the current view. */ for (i = 0; i < view->nr && int128_nz(remain); ++i) { @@ -852,6 +854,10 @@ static void address_space_update_ioeventfds(AddressSpace *as) static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) { + if (!fr->has_coalesced_range) { + return; + } + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, int128_get64(fr->addr.start), int128_get64(fr->addr.size)); @@ -863,6 +869,11 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) CoalescedMemoryRange *cmr; AddrRange tmp; + if (QTAILQ_EMPTY(&mr->coalesced)) { + return; + } + + fr->has_coalesced_range = true; QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start, From patchwork Wed Dec 12 15:22:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726577 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 BACAC174F for ; Wed, 12 Dec 2018 15:39:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9E7DB29B58 for ; Wed, 12 Dec 2018 15:39:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E54B29B79; Wed, 12 Dec 2018 15:39:33 +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 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 ECED829B58 for ; Wed, 12 Dec 2018 15:39:32 +0000 (UTC) Received: from localhost ([::1]:45643 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6bk-0005ni-4r for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:39:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mc-0000tc-C2 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MZ-0000HX-9T for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:38516) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-0008Rd-HN for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x336.google.com with SMTP id m22so6399228wml.3 for ; Wed, 12 Dec 2018 07:23:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=rd2Vyu38hRvfe0+5R7hABpqckE2TpPeLieSeYkqFf+Q=; b=t8pHyYUn1Or5p9NAloMvr+SqW/E4aRS7g82dx/BQnBOOTpa5s726I9aYfhivEW0oY0 JAiZ4ZM/rTfJ3eoIk/4pispq/K+SUmRsGDEGify0M5b72dsuLweoG4KSNyMm8Jtjy3hZ j8jdxNfFgITwhcIvVGOvWa9cuqV6c7Qe8o1HUFkpDxv0hSaYaEosZiIdupIfL9xtv0zw Y5VpPS1gu3XCqI241DwfJpwj/it03rT9Onnf4A83s7hyW4guTG8CtNQzxvf4SR8ZcYrR Wk1vgp9UogttTLGyi3bildPcQDKn3GomO5c0cHD1USUDsGwzUn87LqrWadkthGmwv56L Ihow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=rd2Vyu38hRvfe0+5R7hABpqckE2TpPeLieSeYkqFf+Q=; b=r0ZkOT+raSwMsjw6fRNjLmdaFhD8g+yhdI3hxSwksqijcFScTxEClYakPvLmj0yjOi 4lsCFQdFQ7q3WppRuU/JCmi4vlGsANR/esG0FVo2wuiYv6E/OYhALarxGKJcdp+o0SCg 7Nh5nQMxoPkv1NgHCMp9jkPiEAtmKYse6uf8vLNs2oblJxPbJ7p137WepJpLfaEEewWU 2aI798Ke2RayQkleBtPNZsKs8hmr+66fkjZ0GQtg4lUi6NykIlM0TNmy3GbSxBXRwIPh xRhRvsVI0QPfTY6pn83qF61C6Kc14YjB46HIUHifTBErn+CXC6MiNLjmCWwKY6R1W5fs 7LoA== X-Gm-Message-State: AA+aEWbLZwL751Ug4pkUeDjnZLKQuDIIiC8PK+6uGZUZnmBlW4oLDMnR 0y8dhMUtRMAZ1BXV6swkU8JRlTTA X-Google-Smtp-Source: AFSGD/UG7kJIR4JRZuzopTEyQB6ZIcw/KXrQuDIPcIbLNW9SUFbLM3cQxBSfnpmnW4dEIZfiMX5uIw== X-Received: by 2002:a1c:2d42:: with SMTP id t63mr7041731wmt.9.1544628210401; Wed, 12 Dec 2018 07:23:30 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:29 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:31 +0100 Message-Id: <1544628195-37728-11-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL 10/54] memory: update coalesced_range on transaction_commit 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The e1000 driver calls memory_region_add_coalescing but kvm_coalesce_mmio_region is never called for those regions. The bug dates back to the introduction of the memory region API; to fix it, delete and re-add coalesced MMIO ranges when building the FlatViews. Because coalesced MMIO regions apply to all address spaces, the has_coalesced_range flag has to be changed into an int. Fixes: 093bc2cd885e ("Hierarchical memory region API") Reported-by: Atsushi Nemoto Signed-off-by: Paolo Bonzini --- memory.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/memory.c b/memory.c index 072769a..5759f74 100644 --- a/memory.c +++ b/memory.c @@ -217,7 +217,7 @@ struct FlatRange { bool romd_mode; bool readonly; bool nonvolatile; - bool has_coalesced_range; + int has_coalesced_range; }; #define FOR_EACH_FLAT_RANGE(var, view) \ @@ -651,7 +651,7 @@ static void render_memory_region(FlatView *view, fr.romd_mode = mr->romd_mode; fr.readonly = readonly; fr.nonvolatile = nonvolatile; - fr.has_coalesced_range = false; + fr.has_coalesced_range = 0; /* Render the region itself into any gaps left by the current view. */ for (i = 0; i < view->nr && int128_nz(remain); ++i) { @@ -858,6 +858,10 @@ static void flat_range_coalesced_io_del(FlatRange *fr, AddressSpace *as) return; } + if (--fr->has_coalesced_range > 0) { + return; + } + MEMORY_LISTENER_UPDATE_REGION(fr, as, Reverse, coalesced_io_del, int128_get64(fr->addr.start), int128_get64(fr->addr.size)); @@ -873,7 +877,10 @@ static void flat_range_coalesced_io_add(FlatRange *fr, AddressSpace *as) return; } - fr->has_coalesced_range = true; + if (fr->has_coalesced_range++) { + return; + } + QTAILQ_FOREACH(cmr, &mr->coalesced, link) { tmp = addrrange_shift(cmr->addr, int128_sub(fr->addr.start, @@ -920,6 +927,7 @@ static void address_space_update_topology_pass(AddressSpace *as, /* In old but not in new, or in both but attributes changed. */ if (!adding) { + flat_range_coalesced_io_del(frold, as); MEMORY_LISTENER_UPDATE_REGION(frold, as, Reverse, region_del); } @@ -927,7 +935,9 @@ static void address_space_update_topology_pass(AddressSpace *as, } else if (frold && frnew && flatrange_equal(frold, frnew)) { /* In both and unchanged (except logging may have changed) */ - if (adding) { + if (!adding) { + flat_range_coalesced_io_del(frold, as); + } else { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_nop); if (frnew->dirty_log_mask & ~frold->dirty_log_mask) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, log_start, @@ -939,6 +949,7 @@ static void address_space_update_topology_pass(AddressSpace *as, frold->dirty_log_mask, frnew->dirty_log_mask); } + flat_range_coalesced_io_add(frnew, as); } ++iold; @@ -948,6 +959,7 @@ static void address_space_update_topology_pass(AddressSpace *as, if (adding) { MEMORY_LISTENER_UPDATE_REGION(frnew, as, Forward, region_add); + flat_range_coalesced_io_add(frnew, as); } ++inew; From patchwork Wed Dec 12 15:22:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726549 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 EAF6C1759 for ; Wed, 12 Dec 2018 15:28:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D85602B148 for ; Wed, 12 Dec 2018 15:28:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCE8C2B164; Wed, 12 Dec 2018 15:28:20 +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 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 6F11E2B148 for ; Wed, 12 Dec 2018 15:28:20 +0000 (UTC) Received: from localhost ([::1]:45582 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Qt-0003UE-ID for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:28:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52047) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MO-0000f7-FZ for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MK-0008WJ-OP for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:55383) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MI-0008S8-Nm for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id y139so6132455wmc.5 for ; Wed, 12 Dec 2018 07:23:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DsIsLtuO5RdxAw0elYxuW2hzGaDKfmqByJNpkXktgXk=; b=M11ciZHkpgnpNnZaqLzHi9AgD1Hk1jR7RJTh9k9xK8K1IMccHaXRXPSTzIRul+ebRl KVHaCvZGd1AkJ19wiAnjv5kKY4C/3m31gJwd+Sl4mUMvyQsqUgB+GcnD0aOLWY9iuZDl l5zvvHq657w9BkE2X3xAoZIVBjAB3oKQAJrD8ZkF+Or/ylvPwsnS+7Luriu8EOo8RBV+ JDq4G+1MMdXeZ90OvZIFyugWd4qjIlIFzsceQ8WQwbs/9d7pv3q4qHFOSiGgPt0hGBii ezm15AioOb6qzpqnZ20gLb3lwRMoF/BuemcY0BORwutpZ+E11OPmRiK/nKKkEXf+eHcU 6hiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DsIsLtuO5RdxAw0elYxuW2hzGaDKfmqByJNpkXktgXk=; b=mTvWg2gErfcYsZeYx3f2O6SGRcJNB4dmkCJRQsmFONfyntxbODm8C2TuexQL3eEHkv Nmb+801rXK8bip90Y5aOHoOyy8Lic2vOZSjzLz3sZlPQFf7nTPkP0Yxf4cM7GFyxdV3A bihHJIaLKee1JFNUD3f+U3LH34Wvg8SGKSaOghUPLLXOcNwgIO6Z9Sies3NJJS+0iDb6 fXdEijryvBP+moC2qtNhP9PM17VCFDK68x60nmS95rXHD9RIqOa7aZfQB8V1F/PVecHm t+8Ts20I1DMvrlEkEAs6vEJcjMwBl4TZBC5k8YOCbwLxDzXgurlh2SkCbaZfQP4pVplU LrZg== X-Gm-Message-State: AA+aEWakrYje4guRioUhqSD+rciBSXRg3zEizYIR2tTUJTJajvZmM2JG h3usO5ZBoelTsI7xx6a6NC3K1NTL X-Google-Smtp-Source: AFSGD/Vlc+Jc8by9gsZ+P9ml4uVIUjVGZbpJcohNpZAMT0foQ1e/UKueC6RvHreN6udBkBKpFKUxKg== X-Received: by 2002:a1c:7fca:: with SMTP id a193mr6756159wmd.36.1544628211337; Wed, 12 Dec 2018 07:23:31 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:30 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:32 +0100 Message-Id: <1544628195-37728-12-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 11/54] hax: Support for Linux hosts 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: Alexandro Sanchez Bach Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Alexandro Sanchez Bach Intel HAXM supports now 32-bit and 64-bit Linux hosts. This patch includes the corresponding userland changes. Since the Darwin userland backend is POSIX-compliant, the hax-darwin.{c,h} files have been renamed to hax-posix.{c,h}. This prefix is consistent with the naming used in the rest of QEMU. Signed-off-by: Alexandro Sanchez Bach Message-Id: <20181115013331.65820-1-asanchez@kryptoslogic.com> Signed-off-by: Paolo Bonzini --- target/i386/Makefile.objs | 6 +++--- target/i386/hax-i386.h | 6 +++--- target/i386/{hax-darwin.c => hax-posix.c} | 0 target/i386/{hax-darwin.h => hax-posix.h} | 0 4 files changed, 6 insertions(+), 6 deletions(-) rename target/i386/{hax-darwin.c => hax-posix.c} (100%) rename target/i386/{hax-darwin.h => hax-posix.h} (100%) diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs index 32bf966..cb9c265 100644 --- a/target/i386/Makefile.objs +++ b/target/i386/Makefile.objs @@ -12,10 +12,10 @@ obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o ifeq ($(CONFIG_WIN32),y) obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-windows.o endif -ifeq ($(CONFIG_DARWIN),y) -obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-darwin.o -obj-$(CONFIG_HVF) += hvf/ +ifeq ($(CONFIG_POSIX),y) +obj-$(CONFIG_HAX) += hax-all.o hax-mem.o hax-posix.o endif +obj-$(CONFIG_HVF) += hvf/ obj-$(CONFIG_WHPX) += whpx-all.o endif obj-$(CONFIG_SEV) += sev.o diff --git a/target/i386/hax-i386.h b/target/i386/hax-i386.h index 6abc156..f13fa46 100644 --- a/target/i386/hax-i386.h +++ b/target/i386/hax-i386.h @@ -16,7 +16,7 @@ #include "cpu.h" #include "sysemu/hax.h" -#ifdef CONFIG_DARWIN +#ifdef CONFIG_POSIX typedef int hax_fd; #endif @@ -82,8 +82,8 @@ hax_fd hax_mod_open(void); void hax_memory_init(void); -#ifdef CONFIG_DARWIN -#include "target/i386/hax-darwin.h" +#ifdef CONFIG_POSIX +#include "target/i386/hax-posix.h" #endif #ifdef CONFIG_WIN32 diff --git a/target/i386/hax-darwin.c b/target/i386/hax-posix.c similarity index 100% rename from target/i386/hax-darwin.c rename to target/i386/hax-posix.c diff --git a/target/i386/hax-darwin.h b/target/i386/hax-posix.h similarity index 100% rename from target/i386/hax-darwin.h rename to target/i386/hax-posix.h From patchwork Wed Dec 12 15:22:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726583 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 CC4BB14BD for ; Wed, 12 Dec 2018 15:41:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDBC62B275 for ; Wed, 12 Dec 2018 15:41:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BC7142B304; Wed, 12 Dec 2018 15:41:44 +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 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 506092B3D6 for ; Wed, 12 Dec 2018 15:41:44 +0000 (UTC) Received: from localhost ([::1]:45646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6dr-0006Lx-0T for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:41:43 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ma-0000ri-Rs for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MZ-0000HI-1v for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:54624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-0008TD-C1 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x329.google.com with SMTP id a62so6178136wmh.4 for ; Wed, 12 Dec 2018 07:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=9bD4vF/SlqiZQomVw94Gxcz7amk2GbQ9PdomFkHSTsc=; b=izM05tTo3TPRAbVC/bM3IC4Fv5aOoCF3lpMJROZWxfzYKvcayfad+7mUrcWx97lb9K /jRVwccJPgzdE7uZ/mNdcqxWxYlvbyp3L4mT3JOnjh8GTjwky6zNCVDVpVNyaTUt0L00 NQuWep9MQGIHMmeFMgJNv0J/Gm1HOvibiY2d83w+y+gFspdDCaMEtRRtcUygo2bk9cfH iVwBpSJwkXLNhw+BP9KoB1B35T4OohSiYdVoVTEPeMFxuJpUnkbg17ToTGSDIoS04qmp awTkgIwZmUkZuMoTA0NTWGA7SXbhuktY5dvy1t3uQFVl1s/LWMaqJaAPNnkYLYr63SHQ 1vvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=9bD4vF/SlqiZQomVw94Gxcz7amk2GbQ9PdomFkHSTsc=; b=IP5XqP9aWmwc57jQ/pba6SgOJSnpSb/UFaxl2VJWJ2YJ7o895kqwCLYo2YRtX2BA4a t66Ne5gRaCkwFHYNOY453zyel5ROluT4wCGFnAOEFdoNoxjiNTcLs8tkO+0o7GX2aUZ/ Er8yHyiI7SfI7LFTYbxlbNQZvLOO9huIXuY2HAXe34T6+4aLi5Xeed4VWuTGiOB88hD9 XgwbBrSkPy9BWGZQYvij6ibF3zcoayzNbyPZgaXBDqZCFeNAuz6u84WKTl2wzNSO+X3d ZWtKUzY7vYafVtGbY5O57ETpbjeOmPneQl7qU76GhjX0CpwXQx7AdtpImovO5lGkamzm VmZA== X-Gm-Message-State: AA+aEWZwm9UJSpNgBzGgJ+aI0pRqbDMGlqOu5H2RpUpdNliYgE3R5vRm 5dC/l6xJxwl+FgA27HVai/KQfVFa X-Google-Smtp-Source: AFSGD/WTH4zRvEEmI2635Gc4++Izqi/7Qz3VwX5prvyYCP9yfu5lPd+/rwCgp12SDhhUub3bTbfYfQ== X-Received: by 2002:a1c:d988:: with SMTP id q130mr7073051wmg.41.1544628212229; Wed, 12 Dec 2018 07:23:32 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:31 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:33 +0100 Message-Id: <1544628195-37728-13-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 12/54] block/iscsi: drop unused IscsiAIOCB->buf field 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Hajnoczi The IscsiAIOCB->buf field has not been used since commit e49ab19fcaa617ad6cdfe1ac401327326b6a2552 ("block/iscsi: bump libiscsi requirement to 1.9.0"). It used to be a linear buffer for old libiscsi versions that didn't support scatter-gather. The minimum libiscsi version supports scatter-gather so we don't linearize buffers anymore. Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-2-stefanha@redhat.com> Reviewed-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- block/iscsi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 727dee5..a4e3730 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -117,7 +117,6 @@ typedef struct IscsiAIOCB { QEMUBH *bh; IscsiLun *iscsilun; struct scsi_task *task; - uint8_t *buf; int status; int64_t sector_num; int nb_sectors; @@ -150,9 +149,6 @@ iscsi_bh_cb(void *p) qemu_bh_delete(acb->bh); - g_free(acb->buf); - acb->buf = NULL; - acb->common.cb(acb->common.opaque, acb->status); if (acb->task != NULL) { @@ -933,9 +929,6 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, { IscsiAIOCB *acb = opaque; - g_free(acb->buf); - acb->buf = NULL; - acb->status = 0; if (status < 0) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s", @@ -1010,7 +1003,6 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->iscsilun = iscsilun; acb->bh = NULL; acb->status = -EINPROGRESS; - acb->buf = NULL; acb->ioh = buf; if (req != SG_IO) { From patchwork Wed Dec 12 15:22:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726561 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 B007B174F for ; Wed, 12 Dec 2018 15:33:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F02B2AB26 for ; Wed, 12 Dec 2018 15:33:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91A672AC8D; Wed, 12 Dec 2018 15:33:10 +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 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 D9C902AB26 for ; Wed, 12 Dec 2018 15:33:09 +0000 (UTC) Received: from localhost ([::1]:45605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6VY-0007ap-MJ for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:33:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52311) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ma-0000r7-5K for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000G2-9x for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:33942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0008U9-Qy for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x334.google.com with SMTP id y185so11704432wmd.1 for ; Wed, 12 Dec 2018 07:23:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fQpLtsThwt5DuhFXbBcnqc82C2vXp/ZdCRb88kBMhR0=; b=X2XuGwaIoLXA4gZhar9y9Yf7HLcJccBD0Bdnae8Hli4nrgxrg8Ctui/PNHmcSGLXIw rgzkk0jn3bDiLV1G7rv48jg9Pu0xUcU5ejIt439fkdi4uTsGwW6KPnhLVUyjUWw6GKCc oMXdrXjCuUMjB0DLnqlqUHIzdkcaFtN0Y0U4U9PGuEUluWv0vszrG8nh2irShVO+QtLa nHa+1yqxU6QH6ujtKQ6Mx9xarlVf4yPU6fjDj5r3NbQ1bEsk2P4VIZLLYw+H1zKbYIcR ceqRP8t/c6J5p/eeKYdKDpTmi6xndSmTvugMOgaNGmBbC+xvGv0Aiyp/OWSbN/aOg4g8 ugxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=fQpLtsThwt5DuhFXbBcnqc82C2vXp/ZdCRb88kBMhR0=; b=iCx8B5Z8gYNgA4K7+SafQNQi/BGy7hFznGIjKm4RC1VjYegzSnV1fhsAcuZ/cXvD+Z JSruxX8DzM3/vw2m3WZ1DRTQq72FYY29g9hcnZW9dY8pGY622vySBGuBfOMl3+NLjDnd LqCKtiszxm1azfVMFzpy+OcqOFUyfpgUap1LtuZr3h1Tc1I9WgnlpXBj9NdIoaGIwJxv CJYnPi14dDBUm5AuVWy24qrS3rarylv+Q3Wtm9kGzHn72BYSdIDNwQYnE8MKSJ10qsiG uq6cTWjNB24KvOEqRrUKU0sJnYvutN0jy9ZXTHThtRU4ssWHn+MxBBOtAQ60/rr5e6s+ bhfQ== X-Gm-Message-State: AA+aEWbv1sUfnGh6AxMz37sWhQNkQo1uOxTpRoiKVBztF65Ee2MzX9FQ ogbm1yfB9BiAgHBfVZqxOvAMfFQJ X-Google-Smtp-Source: AFSGD/X+is3mwqR7mQjXXGhmbyxRJ9IfRNWRqmJ800UbuiL936Bs7x0y2a553zKN4QKUnSVXeXrAWA== X-Received: by 2002:a7b:c142:: with SMTP id z2mr7112298wmi.102.1544628213276; Wed, 12 Dec 2018 07:23:33 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:32 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:34 +0100 Message-Id: <1544628195-37728-14-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 13/54] block/iscsi: take iscsilun->mutex in iscsi_timed_check_events() 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Hajnoczi Commit d045c466d9e62b4321fadf586d024d54ddfd8bd4 ("iscsi: do not use aio_context_acquire/release") introduced iscsilun->mutex but appears to have overlooked iscsi_timed_check_events() when introducing the mutex. iscsi_service() and iscsi_set_events() must be called with iscsilun->mutex held. iscsi_timed_check_events() is invoked from the AioContext and does not take the mutex. Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-3-stefanha@redhat.com> Reviewed-by: Paolo Bonzini Signed-off-by: Paolo Bonzini --- block/iscsi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/iscsi.c b/block/iscsi.c index a4e3730..1924a2b 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -344,6 +344,8 @@ static void iscsi_timed_check_events(void *opaque) { IscsiLun *iscsilun = opaque; + qemu_mutex_lock(&iscsilun->mutex); + /* check for timed out requests */ iscsi_service(iscsilun->iscsi, 0); @@ -356,6 +358,8 @@ static void iscsi_timed_check_events(void *opaque) * to return to service once this situation changes. */ iscsi_set_events(iscsilun); + qemu_mutex_unlock(&iscsilun->mutex); + timer_mod(iscsilun->event_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME) + EVENT_INTERVAL); } From patchwork Wed Dec 12 15:22:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726545 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 D6F1516B1 for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C72712B164 for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BBFE42B166; Wed, 12 Dec 2018 15:28:07 +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 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 49C3F2B148 for ; Wed, 12 Dec 2018 15:28:07 +0000 (UTC) Received: from localhost ([::1]:45584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Qg-0004pI-Fw for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:28:06 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52088) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MR-0000hE-3l for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MO-00006n-F1 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:42 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:37659) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MK-0008VB-O6 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:38 -0500 Received: by mail-wm1-x330.google.com with SMTP id g67so6365305wmd.2 for ; Wed, 12 Dec 2018 07:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jq9RYK9Nl/q9VaGrDtTKXipkoxjHVEAmE049EAw6qrY=; b=JUUJOoj/7dI+O8E7cbxIVOmoccka6hicladNm7Ua/Vk3RyQ1nV0/WcfYeuA+839NV7 sdxzBcJsqR0GaDnRzUqZT/eeWujON3tuc9LiXFmXBo7bg+nPgm3cKUhKNmCafpIiEwpJ XMrGF7uGByZSDWYHmIZg5vtybCgpQqNrCbf5FbyGL2LyWTzWxSMeL4mndPPLGRVFSJqU Cn+Rll5aRRTwqvEup8RUJWgXAXC08Z8gS1OyvXp/wYLun/0VIMOwszOv/IeQp9wAWEUR YJ2D6DLJ4NszwBikjqFraykPMu+6kSrDH8TpztHDc0dFm0C2DguQC92s1Con33Erpxxz YS3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jq9RYK9Nl/q9VaGrDtTKXipkoxjHVEAmE049EAw6qrY=; b=Dz94pyTh2PWWbc8y72XHbfcQnBFSApgNdGh2c7mF/sDe//NAz9XdSVRncc5oEd5S3L nevF6G5sz4xFMeJvnyX7kSVtIPy8o+SVw5GOFgQjMtkuxz30/bq9CKfAelBVqETf87xj aArz2UWI2ONjKNlpXr+ioHE/woLTpbga2XuV0P6jqOGC34+Vv2myMl0PPoLq8dxS5J7j 8LIPhP9pNNz5KJW7fBVfoZYkoLxZ7AggnYBcTOJeWQqvSfKOSCDcUeceyQw37XDw9Q6D wq3wnr+AbnU24uqay6EE3FB/QJn91rp1JIu/Lt9Lg3GfwiDhXmlYwNZt0Kj7gmYOnwEJ zJxg== X-Gm-Message-State: AA+aEWZyzwmtR7CsBf5q133zxkizUtbZVEywT4zcl0LgVM81gYDGqcuI 1C92dm1rUhFCD7rpOCAYJjxtR8Br X-Google-Smtp-Source: AFSGD/WhmmodNxts1y3cclbC/btF0vrSwDlk8rqEsF9NeVP8vAkLWOq6i2UUQqr6zg3EktmWS44guQ== X-Received: by 2002:a7b:cc86:: with SMTP id p6mr711179wma.19.1544628214194; Wed, 12 Dec 2018 07:23:34 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:35 +0100 Message-Id: <1544628195-37728-15-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 14/54] block/iscsi: fix ioctl cancel use-after-free 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Hajnoczi iscsi_aio_cancel() does not increment the request's reference count, causing a use-after-free when ABORT TASK finishes after the request has already completed. There are some additional issues with iscsi_aio_cancel(): 1. Several ABORT TASKs may be sent for the same task if iscsi_aio_cancel() is invoked multiple times. It's better to avoid this just in case the command identifier is reused. 2. The iscsilun->mutex protection is missing in iscsi_aio_cancel(). Reported-by: Felipe Franciosi Signed-off-by: Stefan Hajnoczi Message-Id: <20180203061621.7033-4-stefanha@redhat.com> Reviewed-by: Felipe Franciosi Tested-by: Sreejith Mohanan Signed-off-by: Paolo Bonzini --- block/iscsi.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index 1924a2b..abb872d 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -124,6 +124,7 @@ typedef struct IscsiAIOCB { #ifdef __linux__ sg_io_hdr_t *ioh; #endif + bool cancelled; } IscsiAIOCB; /* libiscsi uses time_t so its enough to process events every second */ @@ -287,6 +288,7 @@ static void iscsi_co_init_iscsitask(IscsiLun *iscsilun, struct IscsiTask *iTask) }; } +/* Called (via iscsi_service) with QemuMutex held. */ static void iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, void *private_data) @@ -295,6 +297,7 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, acb->status = -ECANCELED; iscsi_schedule_bh(acb); + qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */ } static void @@ -303,14 +306,25 @@ iscsi_aio_cancel(BlockAIOCB *blockacb) IscsiAIOCB *acb = (IscsiAIOCB *)blockacb; IscsiLun *iscsilun = acb->iscsilun; - if (acb->status != -EINPROGRESS) { + qemu_mutex_lock(&iscsilun->mutex); + + /* If it was cancelled or completed already, our work is done here */ + if (acb->cancelled || acb->status != -EINPROGRESS) { + qemu_mutex_unlock(&iscsilun->mutex); return; } + acb->cancelled = true; + + qemu_aio_ref(acb); /* released in iscsi_abort_task_cb() */ + /* send a task mgmt call to the target to cancel the task on the target */ - iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task, - iscsi_abort_task_cb, acb); + if (iscsi_task_mgmt_abort_task_async(iscsilun->iscsi, acb->task, + iscsi_abort_task_cb, acb) < 0) { + qemu_aio_unref(acb); /* since iscsi_abort_task_cb() won't be called */ + } + qemu_mutex_unlock(&iscsilun->mutex); } static const AIOCBInfo iscsi_aiocb_info = { @@ -1008,6 +1022,7 @@ static BlockAIOCB *iscsi_aio_ioctl(BlockDriverState *bs, acb->bh = NULL; acb->status = -EINPROGRESS; acb->ioh = buf; + acb->cancelled = false; if (req != SG_IO) { iscsi_ioctl_handle_emulated(acb, req, buf); From patchwork Wed Dec 12 15:22:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726557 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 9DAFE16B1 for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D2462AB26 for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 74D2E2ADB5; Wed, 12 Dec 2018 15:30:59 +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 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 1E6052AB61 for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: from localhost ([::1]:45602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6TS-0007DI-8o for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:30:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000py-6b for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000Ee-B6 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:55390) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MW-0008Vd-Vo for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wm1-x330.google.com with SMTP id y139so6132645wmc.5 for ; Wed, 12 Dec 2018 07:23:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=uPaT0p8VJsvqef3cLGXCD9zDoUfQqofW9BxFkZ06I6g=; b=o4L/fDodRSn8j/eyJaIja6P6CobQwB9Qn1tLBc/TK8CTVaQiGrXfRju1uNQYQp03an Kr7110ndlWXqw+WdU+F2dYcJ581EzRxwSXv4FcOtuze7MqVaXTxhjBc09thiV4/vUii8 aPnPWiDenrzGbPmxfy6I1QkMMia7TVh59rdH3toq9YG3tZKW/EBJ1M5VEQxw52KZC8UN Eyb7j6xDiVpGYXEmcYXAKBsXI/CZKWopz7opj5djUtFX3lij+83mmNmirg8NDzLpH/pi 8LyFTT9lASbw+Kg+OEcOsC7PJIQ9CY+jaSjISEf1AKXeIlvDMAPBMdLqOwS4oCHpm7+E UYxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=uPaT0p8VJsvqef3cLGXCD9zDoUfQqofW9BxFkZ06I6g=; b=cyv4wD9EC4aP0UpothiZiYm1wwdlvtFrs7v1AnuCx/7Wffs2/rFBAhbU3Qa1MYa08J c023pkBQn2eSXhlsLI1wSdTRVlYOypOYyBVEy43uaOj+TgQl7DgmwVgX4hz9Jok6xHwz 8ARja+BKpaPlgTJqN3QEMQndvNd6AXEpp+G7Yrpqw5R+PgKRfKwmU6fZu4l/vddU7ukT SMAI7/ugZBq7VHga2P1AMzUidiWTQrmGIYThH6jKBSxVyBSFrFFNn0zNIqs6jIE7L2xg zbnRl0Fjhkg6LCHCh4D89A7tm7woGTq+4wR5/LNpg1jypodgAWTo6BGDgO6qlu0q6nFC FR1Q== X-Gm-Message-State: AA+aEWbQVpOknUzGkReMUsyCfEe4m727XdJa5UHk65y1rokoccVu4nyE qBaRlQVPdPlXhI9TN0Qq9UAKwzGt X-Google-Smtp-Source: AFSGD/XAoL18wxrqartSHfvQlqiJmibpvxg6lG8lAkLB0CgDm77vSefMT9/Hq0hSoKBA6VJdWPP+Tg== X-Received: by 2002:a1c:8acf:: with SMTP id m198mr7140746wmd.143.1544628215115; Wed, 12 Dec 2018 07:23:35 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:34 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:36 +0100 Message-Id: <1544628195-37728-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::330 Subject: [Qemu-devel] [PULL 15/54] block/iscsi: cancel libiscsi task when ABORT TASK TMF completes 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: Stefan Hajnoczi Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Stefan Hajnoczi The libiscsi iscsi_task_mgmt_async() API documentation says: abort_task will also cancel the scsi task. The callback for the scsi task will be invoked with SCSI_STATUS_CANCELLED The libiscsi implementation does not fulfil this promise. The task's callback is not invoked and its struct iscsi_pdu remains in the internal list (effectively leaked). This patch invokes the libiscsi iscsi_scsi_cancel_task() API to force the task's callback to be invoked with SCSI_STATUS_CANCELLED when the ABORT TASK TMF completes and the task's callback hasn't been invoked yet. Signed-off-by: Stefan Hajnoczi Message-Id: <20180215111526.2464-1-stefanha@redhat.com> Signed-off-by: Paolo Bonzini --- block/iscsi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/block/iscsi.c b/block/iscsi.c index abb872d..a7e8c1f 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -295,8 +295,12 @@ iscsi_abort_task_cb(struct iscsi_context *iscsi, int status, void *command_data, { IscsiAIOCB *acb = private_data; - acb->status = -ECANCELED; - iscsi_schedule_bh(acb); + /* If the command callback hasn't been called yet, drop the task */ + if (!acb->bh) { + /* Call iscsi_aio_ioctl_cb() with SCSI_STATUS_CANCELLED */ + iscsi_scsi_cancel_task(iscsi, acb->task); + } + qemu_aio_unref(acb); /* acquired in iscsi_aio_cancel() */ } @@ -947,6 +951,14 @@ iscsi_aio_ioctl_cb(struct iscsi_context *iscsi, int status, { IscsiAIOCB *acb = opaque; + if (status == SCSI_STATUS_CANCELLED) { + if (!acb->bh) { + acb->status = -ECANCELED; + iscsi_schedule_bh(acb); + } + return; + } + acb->status = 0; if (status < 0) { error_report("Failed to ioctl(SG_IO) to iSCSI lun. %s", From patchwork Wed Dec 12 15:22:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726579 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 EFCDA91E for ; Wed, 12 Dec 2018 15:40:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF1C92B223 for ; Wed, 12 Dec 2018 15:40:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DD6D429C15; Wed, 12 Dec 2018 15:40:41 +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 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 2F0C72AA2B for ; Wed, 12 Dec 2018 15:40:41 +0000 (UTC) Received: from localhost ([::1]:45650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6cq-0006fD-72 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:40:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52293) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000qc-Oe for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000Fu-7b for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:36633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0008WP-RA for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x32f.google.com with SMTP id a18so6413088wmj.1 for ; Wed, 12 Dec 2018 07:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=3g/1V6XzmLo7c/znjMeUOk489UsSlVAO+KzqWnYN50o=; b=MjIguW/YOpWPAVZV18UbxIxqBJbLZkMqZiX0W7OF6neDev7uPAjCXbnvrp1dv7U5jf 7uCsfdoKi0AMIsfoyGiMplOE5T1fSiCiz+yEvegqAJT6O0/N3pA79WpUHDs9Uv1y7vMb EyvfLt8rAsaxsGKYuTavpOZhyFMUgCA63TfZxP2xbjD22Bzxfxl2UU8z733116b1pysl LDqWEEVZQ5vhEoN9wyfkbWxA1KLXEH/gmGvx4D4wxbXfkE03PVDK+pDNT/FjD+73wUCW Mdy9PhL4M0GjRJQ9XJpeQLyZ0SojWkNRL3bN1zNEpfJ7X4sR+e5yzipty/VkB2oNGqbQ IGTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=3g/1V6XzmLo7c/znjMeUOk489UsSlVAO+KzqWnYN50o=; b=Fx7EEuvTRVL2mQvvx5bB2WBukHqzdxOFkTwG9Ed73bvJtCshKQMKTaOiW8AlCI8Yz/ 3lufJla7UEeuEF+6mTXw4PL37sHDZ4vWsbmdYIB7tDAx0Xf34Bm/IjQICWPB/dHaTWfL PQvtMwuxvGQVFpPqE/acP1Vf1A7T0dMDbdZn2njJdsPca6q3oRS83l7Gs4oSEozaCaiB FquyGwQKRxL5Nbdu8+Qtv6fQjj0l0CDg8wAw81s0KY6uywbYoihfbv24rdP2DbB1T8tK IQ5mvDXG7iy/FH1Cgad4Jt+wZUM1vscrtDqIZF6Hd/IjorC54Yn+fJu41bMmIduwCq3K qFWg== X-Gm-Message-State: AA+aEWbBlyVADMD+ZmxlErJ2wDIMBRw7zmUt4PGgYWXUiFfDSZzvWAI4 9ykJdK6oIFH6GrQa7fqU2sg15GgZ X-Google-Smtp-Source: AFSGD/VAlo/89J5GzxWMS9MWjpKplPeFZ7jy+xo76mdmUDGVLNws1Ne3OxjN55HGwqh/tNRwW7TMcg== X-Received: by 2002:a1c:2d42:: with SMTP id t63mr7042104wmt.9.1544628216088; Wed, 12 Dec 2018 07:23:36 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:37 +0100 Message-Id: <1544628195-37728-17-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32f Subject: [Qemu-devel] [PULL 16/54] esp-pci: Fix status register write erase control 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: Guenter Roeck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Guenter Roeck Per AM53C974 datasheet, definition of "SCSI Bus and Control (SBAC)" register: Bit 24 'STATUS' Write Erase Control This bit controls the Write Erase feature on bits 3:1 and bit 6 of the DMA Status Register ((B)+54h). When this bit is programmed to '1', the state of bits 3:1 are preserved when read. Bits 3:1 are only cleared when a '1' is written to the corresponding bit location. For example, to clear bit 1, the value of '0000_0010b' should be written to the register. When the DMA Status Preserve bit is '0', bits 3:1 are cleared when read. The status register is currently defined to bit 12, not bit 24. Also, its implementation is reversed: The status is auto-cleared if the bit is set to 1, and must be cleared explicitly when the bit is set to 0. This results in spurious interrupts reported by the Linux kernel, and in some cases even results in stalled SCSI operations. Set SBAC_STATUS to bit 24 and reverse the logic to fix the problem. Signed-off-by: Guenter Roeck Message-Id: <1543442171-24863-1-git-send-email-linux@roeck-us.net> Signed-off-by: Paolo Bonzini --- hw/scsi/esp-pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index 419fc66..d956909 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -59,7 +59,7 @@ #define DMA_STAT_SCSIINT 0x10 #define DMA_STAT_BCMBLT 0x20 -#define SBAC_STATUS 0x1000 +#define SBAC_STATUS (1 << 24) typedef struct PCIESPState { /*< private >*/ @@ -136,7 +136,7 @@ static void esp_pci_dma_write(PCIESPState *pci, uint32_t saddr, uint32_t val) pci->dma_regs[saddr] = val; break; case DMA_STAT: - if (!(pci->sbac & SBAC_STATUS)) { + if (pci->sbac & SBAC_STATUS) { /* clear some bits on write */ uint32_t mask = DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE; pci->dma_regs[DMA_STAT] &= ~(val & mask); @@ -157,7 +157,7 @@ static uint32_t esp_pci_dma_read(PCIESPState *pci, uint32_t saddr) if (pci->esp.rregs[ESP_RSTAT] & STAT_INT) { val |= DMA_STAT_SCSIINT; } - if (pci->sbac & SBAC_STATUS) { + if (!(pci->sbac & SBAC_STATUS)) { pci->dma_regs[DMA_STAT] &= ~(DMA_STAT_ERROR | DMA_STAT_ABORT | DMA_STAT_DONE); } From patchwork Wed Dec 12 15:22:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726573 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 4650016B1 for ; Wed, 12 Dec 2018 15:37:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 329E92862D for ; Wed, 12 Dec 2018 15:37:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 268B22873D; Wed, 12 Dec 2018 15:37:34 +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 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 8283C28694 for ; Wed, 12 Dec 2018 15:37:33 +0000 (UTC) Received: from localhost ([::1]:45627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Zo-0002m3-Or for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:37:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000q8-AN for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000E6-7Q for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:43621) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MW-00005O-Ra for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x432.google.com with SMTP id r10so18076389wrs.10 for ; Wed, 12 Dec 2018 07:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=5v7VLFEIXX21CQdUmXqFjm8l3IxiZYVWdvJfKtp+taQ=; b=ikXfYUfnw9KcOR7rSN4vK5lut7ljWAD1w5D+wZhv4LTyZDRVNpWnE04zX1QLiCg0IF cR5PoVVQYQN4zNPW7pFNi1VcpTqQX6pPHLCttYhguDSL1Za+Vw5OtYX3Bv8MhA55Txpm c0vXnnkGApwxwNwkLUERyq+bNaQKbyJwZe9vsuroHt/k9Hz7Iw3vIaQ2bYMxYf5OWEjk NAFElYa1IiXfXLpolWiLAhsJfnFAMf3/9OktuXPo/824WLwLn+ruTugmvcyxtLW0k+Tf ER1QzdFkuxXd82zIzgijFGXfDQIiectBhXv53cmeZq0as6+y9E63sjIire0Y9TN0R3Bo TOdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=5v7VLFEIXX21CQdUmXqFjm8l3IxiZYVWdvJfKtp+taQ=; b=hWgJBDuV1kOx8dQyqBfX6O48LdQQV3ywogR/SHV33XfVJRq3O8czM9TpiNz6h4L3kF twz4E2IW+Xi279gMJQFWMhvAYwso2Q0reTk05WbWyLJyemMCbLXAE//v1XKa5DeYb+w3 PF5+Po+5tT3NyRWYMTN+HYtkLA0bW/DwGCKHyXW9vJ18UBocc7lrQHGc/Up4DJVWJTop okBSqZ/sQ3qD9N6OD4USzaSCFWlWZniZfiWA7Ds2A9WXvjroXwBQsSmlq0VFzxGexRaD EehFB4FDF2Sl4TLdlxFiZDMkq/xc/hKBfVtnu+F93Qj+G+6HfaWasPNyIgdiWHyZxiUJ T8EQ== X-Gm-Message-State: AA+aEWZ0Sng8Fpba8Xwzd8J0ym6wD3LNwhll4KWg5azMm+fioe43ZMik jbvAsGzx1HxdR4yrGh4K4SWFzoN1 X-Google-Smtp-Source: AFSGD/VrqZXvDMQ32u2OSYojbiH2+YUHJkVKryaIG4x5bRtqEPf89Y2xUBh37LmE9B1AGtyWUux54Q== X-Received: by 2002:a5d:660e:: with SMTP id n14mr17367553wru.19.1544628217175; Wed, 12 Dec 2018 07:23:37 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:36 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:38 +0100 Message-Id: <1544628195-37728-18-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 Subject: [Qemu-devel] [PULL 17/54] scsi: esp: Defer command completion until previous interrupts have been handled 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: Guenter Roeck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Guenter Roeck The guest OS reads RSTAT, RSEQ, and RINTR, and expects those registers to reflect a consistent state. However, it is possible that the registers can change after RSTAT was read, but before RINTR is read, when esp_command_complete() is called. Guest OS qemu -------- ---- [handle interrupt] Read RSTAT esp_command_complete() RSTAT = STAT_ST esp_dma_done() RSTAT |= STAT_TC RSEQ = 0 RINTR = INTR_BS Read RSEQ Read RINTR RINTR = 0 RSTAT &= ~STAT_TC RSEQ = SEQ_CD The guest OS would then try to handle INTR_BS combined with an old value of RSTAT. This sometimes resulted in lost events, spurious interrupts, guest OS confusion, and stalled SCSI operations. A typical guest error log (observed with various versions of Linux) looks as follows. scsi host1: Spurious irq, sreg=13. ... scsi host1: Aborting command [84531f10:2a] scsi host1: Current command [f882eea8:35] scsi host1: Queued command [84531f10:2a] scsi host1: Active command [f882eea8:35] scsi host1: Dumping command log scsi host1: ent[15] CMD val[44] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[00] event[0c] scsi host1: ent[16] CMD val[01] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[17] CMD val[43] sreg[90] seqreg[00] sreg2[00] ireg[20] ss[02] event[0c] scsi host1: ent[18] EVENT val[0d] sreg[92] seqreg[04] sreg2[00] ireg[18] ss[00] event[0c] ... Defer handling command completion until previous interrupts have been handled to fix the problem. Signed-off-by: Guenter Roeck --- hw/scsi/esp-pci.c | 4 ++-- hw/scsi/esp.c | 33 ++++++++++++++++++++++++++------- hw/scsi/trace-events | 1 + include/hw/scsi/esp.h | 2 ++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c index d956909..6b0bbb9 100644 --- a/hw/scsi/esp-pci.c +++ b/hw/scsi/esp-pci.c @@ -313,8 +313,8 @@ static void esp_pci_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_esp_pci_scsi = { .name = "pciespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_PCI_DEVICE(parent_obj, PCIESPState), VMSTATE_BUFFER_UNSAFE(dma_regs, PCIESPState, 0, 8 * sizeof(uint32_t)), diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c index 630d923..ca8b36c 100644 --- a/hw/scsi/esp.c +++ b/hw/scsi/esp.c @@ -286,11 +286,8 @@ static void esp_do_dma(ESPState *s) esp_dma_done(s); } -void esp_command_complete(SCSIRequest *req, uint32_t status, - size_t resid) +static void esp_report_command_complete(ESPState *s, uint32_t status) { - ESPState *s = req->hba_private; - trace_esp_command_complete(); if (s->ti_size != 0) { trace_esp_command_complete_unexpected(); @@ -311,6 +308,23 @@ void esp_command_complete(SCSIRequest *req, uint32_t status, } } +void esp_command_complete(SCSIRequest *req, uint32_t status, + size_t resid) +{ + ESPState *s = req->hba_private; + + if (s->rregs[ESP_RSTAT] & STAT_INT) { + /* Defer handling command complete until the previous + * interrupt has been handled. + */ + trace_esp_command_complete_deferred(); + s->deferred_status = status; + s->deferred_complete = true; + return; + } + esp_report_command_complete(s, status); +} + void esp_transfer_data(SCSIRequest *req, uint32_t len) { ESPState *s = req->hba_private; @@ -422,7 +436,10 @@ uint64_t esp_reg_read(ESPState *s, uint32_t saddr) s->rregs[ESP_RSTAT] &= ~STAT_TC; s->rregs[ESP_RSEQ] = SEQ_CD; esp_lower_irq(s); - + if (s->deferred_complete) { + esp_report_command_complete(s, s->deferred_status); + s->deferred_complete = false; + } return old_val; case ESP_TCHI: /* Return the unique id if the value has never been written */ @@ -582,6 +599,8 @@ const VMStateDescription vmstate_esp = { VMSTATE_UINT32(ti_wptr, ESPState), VMSTATE_BUFFER(ti_buf, ESPState), VMSTATE_UINT32(status, ESPState), + VMSTATE_UINT32(deferred_status, ESPState), + VMSTATE_BOOL(deferred_complete, ESPState), VMSTATE_UINT32(dma, ESPState), VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16), VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4), @@ -671,8 +690,8 @@ static void sysbus_esp_hard_reset(DeviceState *dev) static const VMStateDescription vmstate_sysbus_esp_scsi = { .name = "sysbusespscsi", - .version_id = 0, - .minimum_version_id = 0, + .version_id = 1, + .minimum_version_id = 1, .fields = (VMStateField[]) { VMSTATE_STRUCT(esp, SysBusESPState, 0, vmstate_esp, ESPState), VMSTATE_END_OF_LIST() diff --git a/hw/scsi/trace-events b/hw/scsi/trace-events index 0fb6a99..2fe8a7c 100644 --- a/hw/scsi/trace-events +++ b/hw/scsi/trace-events @@ -167,6 +167,7 @@ esp_handle_satn_stop(uint32_t cmdlen) "cmdlen %d" esp_write_response(uint32_t status) "Transfer status (status=%d)" esp_do_dma(uint32_t cmdlen, uint32_t len) "command len %d + %d" esp_command_complete(void) "SCSI Command complete" +esp_command_complete_deferred(void) "SCSI Command complete deferred" esp_command_complete_unexpected(void) "SCSI command completed unexpectedly" esp_command_complete_fail(void) "Command failed" esp_transfer_data(uint32_t dma_left, int32_t ti_size) "transfer %d/%d" diff --git a/include/hw/scsi/esp.h b/include/hw/scsi/esp.h index 682a0d2..adab63d 100644 --- a/include/hw/scsi/esp.h +++ b/include/hw/scsi/esp.h @@ -23,6 +23,8 @@ struct ESPState { int32_t ti_size; uint32_t ti_rptr, ti_wptr; uint32_t status; + uint32_t deferred_status; + bool deferred_complete; uint32_t dma; uint8_t ti_buf[TI_BUFSZ]; SCSIBus bus; From patchwork Wed Dec 12 15:22:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726615 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 A044C14BD for ; Wed, 12 Dec 2018 15:49:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F60A2B19D for ; Wed, 12 Dec 2018 15:49:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 836F32B1CC; Wed, 12 Dec 2018 15:49:52 +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 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 112E22B19D for ; Wed, 12 Dec 2018 15:49:52 +0000 (UTC) Received: from localhost ([::1]:45690 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6lj-0004as-6c for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:49:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ma-0000rl-TS for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000GY-LK for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:53266) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-00005u-4I for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x335.google.com with SMTP id y1so6137102wmi.3 for ; Wed, 12 Dec 2018 07:23:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LYPJewdjodEeINq2/8LLF2l68lHe+Y3/4A9Jao4qfVM=; b=taLYxpIjWqxSIQnDn7POX6bGolGxTC2/6msHzLlqAR8kVAQk012NkBTRHmZ2Ng5jox umDKfeJNTYzMG1KrZP2uItzVyKS9nS4VZV+74wbQMAtSqnUYTH0shafp9Ii7fPyaRWaS Rs4dglVsj+pIZseUsSiHJWL+8TJ1Q038U8K5+fehd5R9/MRqmbBsdq14y9APB4c9KFL4 DusZF4Ol1jBJPC/P5Wf4BHliFyLEbMfvlDEJl1IHSCA+R0+AJ0ukgjm0kzfBWWuONES1 17RVjyZPVZnHYqIxUol7H4nv758uHGUhjdM2GqyJZ6DmqXevh4rrjO/WXla0Gx4BYPFc QWsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=LYPJewdjodEeINq2/8LLF2l68lHe+Y3/4A9Jao4qfVM=; b=i2Umqn4Ddu1OiaJ5uA9fv6GExa8sdtbEo/CMl17KuE9f1uYObYp9pJG+cd1V7+V5Fi mPt+l4P3+j2hzn7+Za5habg34WjjfbR9wQSKetwp7pVpwp71dDWtQ+FlLs9JsgXreR3M Xm/6hQeop2wQoYE4blBXu6cKfhPN1N4N383sAYQs8z6og0at2Tx3WgZAozxeGb4iQ6H0 KhMxcStvM6e7J1zOBysUUsRy+sy4cGEwgJPy10ryhXLRUVpwZZK8B0VD60dza6GFSml7 nTIrqUx2Dzwkx+u8Kim0t/hNEQXbNnQKJb1CzjBZdVBbXU8AkTu5lgf3ZNApKamjHvyW lnog== X-Gm-Message-State: AA+aEWYLjZ+/suYrEfYK0NfFNMUBBxyPhEEcYP+4qp8iDc/FLCe5A3g/ UsVHe62xBW969rstfopuoD4/tFp6 X-Google-Smtp-Source: AFSGD/XNh0WVdJEIKxjHduB8DLpz5VHJ25B5naxFtROw7873MiWXI77TSH79Oqew13/aVMd3dTTv4A== X-Received: by 2002:a1c:f509:: with SMTP id t9mr5023284wmh.76.1544628218092; Wed, 12 Dec 2018 07:23:38 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:37 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:39 +0100 Message-Id: <1544628195-37728-19-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 18/54] build-sys: don't include windows.h, osdep.h does it 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau osdep.h will also define the available Windows API version for QEMU. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-2-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- accel/tcg/translate-all.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 639f0b2..8cb8c88 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -16,12 +16,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see . */ -#ifdef _WIN32 -#include -#endif #include "qemu/osdep.h" - #include "qemu-common.h" #define NO_CPU_IO_DEFS #include "cpu.h" From patchwork Wed Dec 12 15:22:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726589 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 BBF8914BD for ; Wed, 12 Dec 2018 15:43:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75951285AF for ; Wed, 12 Dec 2018 15:43:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 632F929BE8; Wed, 12 Dec 2018 15:43:34 +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 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 05949285AF for ; Wed, 12 Dec 2018 15:43:34 +0000 (UTC) Received: from localhost ([::1]:45663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6fd-0000wT-3r for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:43:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ma-0000rR-Hp for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000EP-9X for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:42667) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MW-00006K-Ue for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x430.google.com with SMTP id q18so18082005wrx.9 for ; Wed, 12 Dec 2018 07:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=206uFamUArYeYiHIML1Y2Dprs3f9bLhrSp5zPwAXXPQ=; b=PTkNl7aBSsRFWbbujuOm/12G79j8S0zTnDWhqhdtziolwUh7J6Gv6VWVF5IKt0brWa FzM5TgHPHtsRgt/J1LbBjsnQCbAO/efMUDQizF9eA10F/uRAepESl6sOBfS9MEJofhkK N+n4nexXaGNCirs35+7fjg4Pi+5fHxIXq3ld8HsTFHcVYhdHL1eUc+3oUN7pRCppY1QN 7UWfwOj/zF+9Kr8hJ3n1C2tTm+crwltXONuwq8vyJ1uIkxT+iMljxfWTRw6YO/OvY5AA d5FI5ixM3RtaioIo7458WbOFmKmBJm/faLLNlegdm53/PJMfSFL4PLuTOA8vxILyePg7 XMDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=206uFamUArYeYiHIML1Y2Dprs3f9bLhrSp5zPwAXXPQ=; b=jE28sZ3b8HmUcyIIk4RoTFXLj15eXcZqUSG3iNEE0oBfCreRUoT0ms7ISAg1n35ZwB F2I4xBbsjbS5RhCfbmWiJ5hWa7Xm6Erhl9ANHwA2M0z611FG4o070FBZ4U8iW4SW8jQi l6XgaiYuM0qCKuDaq7Tzdl76Ej1MCleXNUQnhUv0smVA1zKt2tfa+0ZDOp4Dl78u4qlt RnddkObGgpi/S+YguwCYZwd3mUcw62lubDPqyVnFYDXBnmkRjkb59mHoJwPobSr9H0nG teByosznIKa2qEnTSNqtXnoNXYYsTZtTcKAADrMr6LoYI1ayglotR0NiyRISL53/NbED 8FhA== X-Gm-Message-State: AA+aEWbGRxj9nBgPRGqrWiPz2a28tZuECHEpnxS5MbgmfJC2t78frPsn Ny34eixttVf/wikdDxQK5kXXMfXA X-Google-Smtp-Source: AFSGD/WZD/+V4RaVFFcGm/96ir/QqRLdANpbtvTyR0DN0CO9QRUv67enUZV8OpPAcVvFr3uFiJJqCg== X-Received: by 2002:adf:8b4d:: with SMTP id v13mr17134005wra.282.1544628219044; Wed, 12 Dec 2018 07:23:39 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:38 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:40 +0100 Message-Id: <1544628195-37728-20-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 Subject: [Qemu-devel] [PULL 19/54] build-sys: move windows defines in osdep.h header 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau This removes some clutter in compilation logging, and allows some easier tweaking per compilation unit/CFLAGS overriding. Note that we can't move those define in os-win32.h, since they must be set before the first system headers are included. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-3-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- configure | 3 --- include/qemu/osdep.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 0a3c6a7..8c292ef 100755 --- a/configure +++ b/configure @@ -905,9 +905,6 @@ fi if test "$mingw32" = "yes" ; then EXESUF=".exe" DSOSUF=".dll" - QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS" - # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) - QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS" # MinGW needs -mthreads for TLS and macro _MT. QEMU_CFLAGS="-mthreads $QEMU_CFLAGS" LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 3bf48bc..7b6e5db 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -74,13 +74,30 @@ typedef __float128 _Float128; extern int daemon(int, int); #endif +#ifdef _WIN32 +/* as defined in sdkddkver.h */ +#ifndef WINVER +#define WINVER 0x0501 /* XP */ +#endif +/* reduces the number of implicitly included headers */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#endif + #include #include #include #include #include #include + +/* enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later) */ +#ifdef __MINGW32__ +#define __USE_MINGW_ANSI_STDIO 1 +#endif #include + #include #include #include From patchwork Wed Dec 12 15:22:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726555 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 84517174F for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 711502AB26 for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 659602AD1B; Wed, 12 Dec 2018 15:30:59 +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 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 0B57D2AB26 for ; Wed, 12 Dec 2018 15:30:59 +0000 (UTC) Received: from localhost ([::1]:45601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6TS-0007Ci-7d for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:30:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52176) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MX-0000mB-Cz for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MW-0000D1-AT for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:41230) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MU-000088-Br for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:46 -0500 Received: by mail-wr1-x431.google.com with SMTP id x10so18066587wrs.8 for ; Wed, 12 Dec 2018 07:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C3Q43PeX3iGo68GzRfJThyjsf5BqaavXdB4G44tB9Ng=; b=Z/rw5dZC2Cv6gPuezQx1t+ejwFOUnAFIjS9fUerWdJ11wgA5t+aTPZcmj/K5tmq2Gy JtJaG4++ghbJGjcKLPcpzi+0DZT++UTael4LNotI/5WAGtKiJtlFb7vSoVs2Jp3khN+6 +yvMff++WMxRLiBZbdDnnJLotzuxTQMKUW+S1l3VGfeoLJZ2efjQbUr6PobI9auHS8JA lYlXbnFSvcvrxYXcNIioe78ZXYGgfJRwBrCj344LEdKD2g1KWR8/eSyLry8VBwC59a65 Q3GJVHSTt4lx/yL8L7QaG1rKacJ7e9/xazRZJaSZSE3Ncgj1HE/QxBURl/ZQWGJSSsqm CmFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=C3Q43PeX3iGo68GzRfJThyjsf5BqaavXdB4G44tB9Ng=; b=aoYZvcUK0Pnq1+zhcVkHCHM3JBLu0dV73DCS41WYclza+V5dVGKxs+Zhw97lMeVqBh vs5mwVIwoOB1+PrsLXfQ6fVbQqeCFnkmmGHdlqkuAKqG2A+2Ilf5SCrAWAoxs7R2mOxs 6YSBGzJ/v4d75Yhpmkz0toZOwsGSlRfR5HiMr1DVMng+1dU3C1KC3BD6UaWibxNY8Xz1 +UQdHQyYwkPM+ZKfJ1lu8JFE6pvf0KkPZL+5474LwMonzDd//kJBBJZ37t9qujcUzmIP xhABCveJYe7QAJg3HL9OHNmJ8DvTMSlKFLg5zBzhghLGPvWg+tEDJpj2qrxTc6oce8AH TIWg== X-Gm-Message-State: AA+aEWa+U+UvmpP13OtEcTgdCA2mqk0bh7LYuL0+cc5p0r/P4dHgze/a IUmb4ac5FmzA3CM/ilpL8o5JZ7Yy X-Google-Smtp-Source: AFSGD/U70iNk7S30GWSe0nfnhzh8XYdN5Sdso9jjeRHXcct2MYsaH3NhUVHyWarTK7qNkTAz7I8kzA== X-Received: by 2002:adf:a78a:: with SMTP id j10mr18076970wrc.191.1544628220579; Wed, 12 Dec 2018 07:23:40 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:39 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:41 +0100 Message-Id: <1544628195-37728-21-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 Subject: [Qemu-devel] [PULL 20/54] build-sys: build with Vista API by default 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Both qemu & qga build with Vista API by default already, by defining _WIN32_WINNT 0x0600. Set it globally in osdep.h instead. This replaces WINVER by _WIN32_WINNT in osdep.h. WINVER doesn't seem to be really useful these days. (see also https://blogs.msdn.microsoft.com/oldnewthing/20070411-00/?p=27283) Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-4-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/osdep.h | 4 ++-- qga/commands-win32.c | 6 +----- util/qemu-thread-win32.c | 4 ---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 7b6e5db..80df725 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -76,8 +76,8 @@ extern int daemon(int, int); #ifdef _WIN32 /* as defined in sdkddkver.h */ -#ifndef WINVER -#define WINVER 0x0501 /* XP */ +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0600 /* Vista */ #endif /* reduces the number of implicitly included headers */ #ifndef WIN32_LEAN_AND_MEAN diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 62e1b51..f03b9c1 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -10,12 +10,8 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ - -#ifndef _WIN32_WINNT -# define _WIN32_WINNT 0x0600 -#endif - #include "qemu/osdep.h" + #include #include #include diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 4a363ca..572f885 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -11,10 +11,6 @@ * */ -#ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0600 -#endif - #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/thread.h" From patchwork Wed Dec 12 15:22:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726569 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 143D816B1 for ; Wed, 12 Dec 2018 15:36:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3EDF2808F for ; Wed, 12 Dec 2018 15:36:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E55FD285AF; Wed, 12 Dec 2018 15:36:31 +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 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 5CA292808F for ; Wed, 12 Dec 2018 15:36:31 +0000 (UTC) Received: from localhost ([::1]:45631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Yo-000355-6Y for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:36:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52275) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000qJ-DH for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000Ep-FB for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46532) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-00008l-2R for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x434.google.com with SMTP id l9so18047851wrt.13 for ; Wed, 12 Dec 2018 07:23:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a9DFt6d5vc25qv90X/5YHrAammQkIh+VOHCJitcVnL0=; b=rUgpU/CMamARd3BBnfX3KJ6RAAic9pIdaU+f/kb92Avb4yghL7IEmBBru6m2zPN+s2 cFiE7d/p5ZpGbf8x/B5Zf8l3ISTwCCffW1mQKm5/gJfmps40SapzPGm2sRcX2sg/JRtR vyBN52PCXvwAaUAoo2zJtYskeyeRn5ZklZeFNVVR6COLjOPxE2oLtEpQBapD4mQnRVWu SYVrcr7PdhJV5RHtxAvr4kVjP6PrRjUdw1PhSiJf3P0O26SraqSzRx5Soxr9lRBgS0MA L3FrQMqwEvpVy98Bx57rkrxlNsBkXipUn/GS6UXqJ1OuUH0bTjHvpfiD++ZqLt7s2OXX MqVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=a9DFt6d5vc25qv90X/5YHrAammQkIh+VOHCJitcVnL0=; b=fMUv989i8ZO0WFxyj1Q65VIOL+Fjbf5JGcQLL8p/ggc9grlE/SPQP17aRWN4tg4Cww yX5yHTlJeCPBMb1ZoaX6P20mJz2eHswJMPiY/X2EIEEHN5nFQt5SiedIOWRQMW0gfT6G Q7wksdy+HnHSf8lecE01Udjr82K9a03hmFtATA+MvPOf09ThtEVdGph0SRgnToo37jQV QL7Y6WfmSR5lphizguwHpymCgjiS72eYampRH5f/+PRML94fw5mMmn/uBs+jiX+PRW/b 3m/CyoHuFWzB337o75iUqlGrG9ulRdJyy1tXi9XzP9XWhobWb4eZv5fyctu+mRcfbTO4 zN3Q== X-Gm-Message-State: AA+aEWbFFiB8cpg+3gSJzS3GBazipXXX+Lxf4SzgyzE/sAe9I8Bga70u L2kjsiy2jZU6EajXF14lvIPfSoOz X-Google-Smtp-Source: AFSGD/VfLBM5bQwRKiBjpUgoojTCbYN9N4Aky0SNwxXB4QD61jxzitRJE8R5hBjAXU6L+rdH8Aq1OA== X-Received: by 2002:adf:e08c:: with SMTP id c12mr16685550wri.199.1544628221491; Wed, 12 Dec 2018 07:23:41 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:40 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:42 +0100 Message-Id: <1544628195-37728-22-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 Subject: [Qemu-devel] [PULL 21/54] RFC: qga: drop < Vista compatibility 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: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Marc-André Lureau Building QGA for XP seems possible so far: the dependency on libqemuutil.a implies building qemu-thread-win32.c, which requires Vista API since commit 12f8def0 (v2.9). But qemu-thread isn't being used in QGA, the resulting binary may still work on XP. XP is no longer supported for the past 4.5y, it's time to drop support for it. Signed-off-by: Marc-André Lureau Message-Id: <20181122110039.15972-5-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- qga/commands-win32.c | 64 ---------------------------------------------------- 1 file changed, 64 deletions(-) diff --git a/qga/commands-win32.c b/qga/commands-win32.c index f03b9c1..989b93e 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -466,13 +466,11 @@ static STORAGE_BUS_TYPE win2qemu[] = { [BusTypeFibre] = GUEST_DISK_BUS_TYPE_SSA, [BusTypeUsb] = GUEST_DISK_BUS_TYPE_USB, [BusTypeRAID] = GUEST_DISK_BUS_TYPE_RAID, -#if (_WIN32_WINNT >= 0x0600) [BusTypeiScsi] = GUEST_DISK_BUS_TYPE_ISCSI, [BusTypeSas] = GUEST_DISK_BUS_TYPE_SAS, [BusTypeSata] = GUEST_DISK_BUS_TYPE_SATA, [BusTypeSd] = GUEST_DISK_BUS_TYPE_SD, [BusTypeMmc] = GUEST_DISK_BUS_TYPE_MMC, -#endif #if (_WIN32_WINNT >= 0x0601) [BusTypeVirtual] = GUEST_DISK_BUS_TYPE_VIRTUAL, [BusTypeFileBackedVirtual] = GUEST_DISK_BUS_TYPE_FILE_BACKED_VIRTUAL, @@ -724,10 +722,8 @@ static void get_single_disk_info(GuestDiskAddress *disk, Error **errp) if (disk->bus_type == GUEST_DISK_BUS_TYPE_SCSI || disk->bus_type == GUEST_DISK_BUS_TYPE_IDE || disk->bus_type == GUEST_DISK_BUS_TYPE_RAID -#if (_WIN32_WINNT >= 0x0600) /* This bus type is not supported before Windows Server 2003 SP1 */ || disk->bus_type == GUEST_DISK_BUS_TYPE_SAS -#endif ) { /* We are able to use the same ioctls for different bus types * according to Microsoft docs @@ -1322,7 +1318,6 @@ static char *guest_addr_to_str(IP_ADAPTER_UNICAST_ADDRESS *ip_addr, return NULL; } -#if (_WIN32_WINNT >= 0x0600) static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) { /* For Windows Vista/2008 and newer, use the OnLinkPrefixLength @@ -1330,60 +1325,6 @@ static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) */ return ip_addr->OnLinkPrefixLength; } -#else -/* When using the Windows XP and 2003 build environment, do the best we can to - * figure out the prefix. - */ -static IP_ADAPTER_INFO *guest_get_adapters_info(void) -{ - IP_ADAPTER_INFO *adptr_info = NULL; - ULONG adptr_info_len = 0; - DWORD ret; - - /* Call the first time to get the adptr_info_len. */ - GetAdaptersInfo(adptr_info, &adptr_info_len); - - adptr_info = g_malloc(adptr_info_len); - ret = GetAdaptersInfo(adptr_info, &adptr_info_len); - if (ret != ERROR_SUCCESS) { - g_free(adptr_info); - adptr_info = NULL; - } - return adptr_info; -} - -static int64_t guest_ip_prefix(IP_ADAPTER_UNICAST_ADDRESS *ip_addr) -{ - int64_t prefix = -1; /* Use for AF_INET6 and unknown/undetermined values. */ - IP_ADAPTER_INFO *adptr_info, *info; - IP_ADDR_STRING *ip; - struct in_addr *p; - - if (ip_addr->Address.lpSockaddr->sa_family != AF_INET) { - return prefix; - } - adptr_info = guest_get_adapters_info(); - if (adptr_info == NULL) { - return prefix; - } - - /* Match up the passed in ip_addr with one found in adaptr_info. - * The matching one in adptr_info will have the netmask. - */ - p = &((struct sockaddr_in *)ip_addr->Address.lpSockaddr)->sin_addr; - for (info = adptr_info; info; info = info->Next) { - for (ip = &info->IpAddressList; ip; ip = ip->Next) { - if (p->S_un.S_addr == inet_addr(ip->IpAddress.String)) { - prefix = ctpop32(inet_addr(ip->IpMask.String)); - goto out; - } - } - } -out: - g_free(adptr_info); - return prefix; -} -#endif #define INTERFACE_PATH_BUF_SZ 512 @@ -1904,7 +1845,6 @@ typedef struct _GA_WTSINFOA { GuestUserList *qmp_guest_get_users(Error **err) { -#if (_WIN32_WINNT >= 0x0600) #define QGA_NANOSECONDS 10000000 GHashTable *cache = NULL; @@ -1974,10 +1914,6 @@ GuestUserList *qmp_guest_get_users(Error **err) } g_hash_table_destroy(cache); return head; -#else - error_setg(err, QERR_UNSUPPORTED); - return NULL; -#endif } typedef struct _ga_matrix_lookup_t { From patchwork Wed Dec 12 15:22:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726607 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 8A8EC174F for ; Wed, 12 Dec 2018 15:46:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79D072AC78 for ; Wed, 12 Dec 2018 15:46:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6913C2B127; Wed, 12 Dec 2018 15:46:37 +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 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 0F1F62AC78 for ; Wed, 12 Dec 2018 15:46:37 +0000 (UTC) Received: from localhost ([::1]:45672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ia-00028r-91 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:46:36 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Ma-0000r2-4A for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000G7-9b for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:51736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-00009q-R2 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x333.google.com with SMTP id s14so6209893wmh.1 for ; Wed, 12 Dec 2018 07:23:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=bF9tDh7ESYGSCI9Phk1pLO54aulpgBTrRZwreniySgM=; b=JhwaFfXAN1/vPmGmg5GnI0CCTDO39zk9/1f81oGNHnGu/5UjawsW31Y18nE6gMC7Y2 SPFopPltpm+AN/wxJusxW4x3k6PpZ+UuFNHv0/qQdcU4Nscmc4NO7vJKNf4d8sf2wp37 FGAcvC4E71q/kL3ql8vtg3NSp/RPoRsM3RmgorvFQxwT4Id+7KLH1yMnIZGxSBgNT3xy zzhHYTY+ncCujYRuKixrPDwFICfBMB6wOBdxgarODIICBLrCh552FrPPxS+1mG025DWB 13+nOpHEC3gHtTJ16DVWoFvNZr1BvvzM7fDV14LHpDirbY9bTyBj4VevQxZD5K/9SAkb hm6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=bF9tDh7ESYGSCI9Phk1pLO54aulpgBTrRZwreniySgM=; b=DURZ4NQyQIPdwicPjXML1zykUlL7PHeDSpoALijNftdezBifTPE01VIKoXT0FY9vG/ OEXdrkW8JSHPPJgExDUBcCRQGB+xCyHVpTG1LKxEznv7Hp6fEmyDsRQS6mGq3C0beQd2 Q0q6ETlK6vp4CzXmMXWdGDYzPf123JuLVeVC8U0Z0DZ0zdodl/FLLT6X+ut7Ze6huOci V5SB40YGkWRa9+D4af6DAJ7Q2vmlHQubaqBr5Yye07tbERjMko1Sd2JvFaLoEWoiV0AO zPOD9LOICza4z8i4y8VFA/JQXbQKlXQe/K6BfiCFv3lo5heiIA6wQlb7UfvO11Lzmn6G swFQ== X-Gm-Message-State: AA+aEWY8C0SGubXdJ/ySWfpzCJ9rjREuDDP2415wChuPqtSX7wntCKCL 6Myf4x59W/seI4Sgm1/1t1XGvddK X-Google-Smtp-Source: AFSGD/UgTnWmDV179sRkX9amyFmLnxlwE5vvNO5shQvkuplXe2e079UroGr6ebzSf80VR2VXZp5h1Q== X-Received: by 2002:a1c:c645:: with SMTP id w66mr7252824wmf.18.1544628222507; Wed, 12 Dec 2018 07:23:42 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:43 +0100 Message-Id: <1544628195-37728-23-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 Subject: [Qemu-devel] [PULL 22/54] test: execute g_test_run when tests are skipped 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Sometimes a test's main() function recognizes that the environment does not support the test, and therefore exits. In this case, we still should run g_test_run() so that a TAP harness will print the test plan ("1..0") and the test will be marked as skipped. Signed-off-by: Paolo Bonzini Message-Id: <1543513531-1151-2-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- tests/cdrom-test.c | 2 +- tests/migration-test.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/cdrom-test.c b/tests/cdrom-test.c index 9b43dc9..14bd981 100644 --- a/tests/cdrom-test.c +++ b/tests/cdrom-test.c @@ -169,7 +169,7 @@ int main(int argc, char **argv) if (exec_genisoimg(genisocheck)) { /* genisoimage not available - so can't run tests */ - return 0; + return g_test_run(); } ret = prepare_image(arch, isoimage); diff --git a/tests/migration-test.c b/tests/migration-test.c index 06ca506..8352612 100644 --- a/tests/migration-test.c +++ b/tests/migration-test.c @@ -789,7 +789,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); if (!ufd_version_check()) { - return 0; + return g_test_run(); } /* @@ -800,7 +800,7 @@ int main(int argc, char **argv) if (g_str_equal(qtest_get_arch(), "ppc64") && access("/sys/module/kvm_hv", F_OK)) { g_test_message("Skipping test: kvm_hv not available"); - return 0; + return g_test_run(); } /* @@ -811,11 +811,11 @@ int main(int argc, char **argv) #if defined(HOST_S390X) if (access("/dev/kvm", R_OK | W_OK)) { g_test_message("Skipping test: kvm not available"); - return 0; + return g_test_run(); } #else g_test_message("Skipping test: Need s390x host to work properly"); - return 0; + return g_test_run(); #endif } From patchwork Wed Dec 12 15:22:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726617 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 3A297174F for ; Wed, 12 Dec 2018 15:50:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 267822B261 for ; Wed, 12 Dec 2018 15:50:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1AFE02B345; Wed, 12 Dec 2018 15:50:11 +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 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 967832B261 for ; Wed, 12 Dec 2018 15:50:09 +0000 (UTC) Received: from localhost ([::1]:45698 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6m0-0006F0-RM for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:50:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mg-0000yO-Gk for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MZ-0000I6-Fb for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:33009) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-0000As-JV for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: by mail-wm1-x341.google.com with SMTP id r24so11701302wmh.0 for ; Wed, 12 Dec 2018 07:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=cUZ5rhrrPYkhy8v6YevfEoM5vcf2a8dQlmeaC6vTFis=; b=VxyvYWVgqFJFjQ3LuDDbFj8xOov6LelMMLNv4s1Ggwu5r06BODUXGu48qKDKnYFYAK Ai5BNd80Azai7XEQeoiBB19aiJcvJvN9tgKmv9X7SApIYU+2c4jfvLLI/khmNmfJ3Eae b1JXTdcJn75XOGqPJVhf1UQQOkoFKJ9Vm+JGEfFsI5yTRekVzBfNfhlkc3tWRPQ9SKoT SClbqN89ytQOcCrLz4sT2w8m9d10fE8Zuz0yhIeyyqxrxiSH9AC0+VzLoUNTlkVVGbp7 pI7+nCWm2JU9+vTtlnoCrHS/aeStU3LhfEuAxdSCEZIQB9uGlF2SXb9nBmcgINrnjZUx ivwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=cUZ5rhrrPYkhy8v6YevfEoM5vcf2a8dQlmeaC6vTFis=; b=dA27q6waJK+Tt6zBuy3t/65I24tJplZwokZosTjZaqDCYwRnQ1iOsbAxwwm4Y+rDA9 QYPdCOspXP3jF/Hkbe7q++g9s9nhOncAn2G9R89K+BKdxmfE9fOjiWubhIKTBA9x6c7u wkIgp2fpjAWIrKvikwYnwg/BdbNcfQbMVYeyg2AdCCLwTKVlitkpgbypTiVH+hYFeku1 MtjUq172CzsW9UkRPZ9COF7M6wD7gGmRtH+KwiA7/xoVgbQ3k8/AacP8JSkSp5UoEfGc DxXbonXvZVCPpIOomBotaDLmYPs7p1SmMCq6W45v+9ynu/TiJsOwHjk1ZIKornrglI1x q1Ow== X-Gm-Message-State: AA+aEWa+CwdwdSjuSziNpDFQdNx45NAfMam1RMHO1MPTAVWP014sI2hE JRR63LOvKeVUweE9ox5+38FlP32j X-Google-Smtp-Source: AFSGD/WRMfXTXIPsqTDMPcIE/GZdKRG4rrQ4EJ46Ho/+COjq6hn3gi01P15gBmVnKJlZO3qUVTgZPA== X-Received: by 2002:a1c:e58c:: with SMTP id c134mr6511175wmh.124.1544628223477; Wed, 12 Dec 2018 07:23:43 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:44 +0100 Message-Id: <1544628195-37728-24-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PULL 23/54] test: replace gtester with a TAP driver 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP gtester is deprecated by upstream glib (see for example the announcement at https://blog.gtk.org/2018/07/11/news-from-glib-2-58/) and it does not support tests that call g_test_skip in some glib stable releases. glib suggests instead using Automake's TAP support, which gtest itself supports since version 2.38 (QEMU's minimum requirement is 2.40). We do not support Automake, but we can use Automake's code to beautify the TAP output. I chose to use the Perl copy rather than the shell/awk one, with some changes so that it can accept TAP through stdin, in order to reuse Perl's TAP parsing package. This also avoids duplicating the parser between tap-driver.pl and tap-merge.pl. Signed-off-by: Paolo Bonzini Message-Id: <1543513531-1151-3-git-send-email-pbonzini@redhat.com> Reviewed-by: Eric Blake Signed-off-by: Paolo Bonzini --- scripts/gtester-cat | 26 -- scripts/tap-driver.pl | 378 +++++++++++++++++++++++++++ scripts/tap-merge.pl | 110 ++++++++ tests/Makefile.include | 54 ++-- tests/docker/dockerfiles/centos7.docker | 1 + tests/docker/dockerfiles/debian-amd64.docker | 1 + tests/docker/dockerfiles/debian-ports.docker | 1 + tests/docker/dockerfiles/debian-sid.docker | 1 + tests/docker/dockerfiles/debian8.docker | 1 + tests/docker/dockerfiles/debian9.docker | 1 + tests/docker/dockerfiles/fedora.docker | 1 + tests/docker/dockerfiles/ubuntu.docker | 1 + 12 files changed, 529 insertions(+), 47 deletions(-) delete mode 100755 scripts/gtester-cat create mode 100755 scripts/tap-driver.pl create mode 100755 scripts/tap-merge.pl diff --git a/scripts/gtester-cat b/scripts/gtester-cat deleted file mode 100755 index 061a952..0000000 --- a/scripts/gtester-cat +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -# -# Copyright IBM, Corp. 2012 -# -# Authors: -# Anthony Liguori -# -# This work is licensed under the terms of the GNU GPLv2 or later. -# See the COPYING file in the top-level directory. - -cat < - - - qemu - 0.0 - rev - -EOF - -sed \ - -e '/$/d' \ - -e '//,/<\/info>/d' \ - -e '$b' \ - -e '/^<\/gtester>$/d' "$@" diff --git a/scripts/tap-driver.pl b/scripts/tap-driver.pl new file mode 100755 index 0000000..5e59b5d --- /dev/null +++ b/scripts/tap-driver.pl @@ -0,0 +1,378 @@ +#! /usr/bin/env perl +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# Copyright (C) 2018 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# ---------------------------------- # +# Imports, static data, and setup. # +# ---------------------------------- # + +use warnings FATAL => 'all'; +use strict; +use Getopt::Long (); +use TAP::Parser; +use Term::ANSIColor qw(:constants); + +my $ME = "tap-driver.pl"; +my $VERSION = "2018-11-30"; + +my $USAGE = <<'END'; +Usage: + tap-driver [--test-name=TEST] [--color={always|never|auto}] + [--verbose] [--show-failures-only] +END + +my $HELP = "$ME: TAP-aware test driver for QEMU testsuite harness." . + "\n" . $USAGE; + +# It's important that NO_PLAN evaluates "false" as a boolean. +use constant NO_PLAN => 0; +use constant EARLY_PLAN => 1; +use constant LATE_PLAN => 2; + +use constant DIAG_STRING => "#"; + +# ------------------- # +# Global variables. # +# ------------------- # + +my $testno = 0; # Number of test results seen so far. +my $bailed_out = 0; # Whether a "Bail out!" directive has been seen. +my $failed = 0; # Final exit code + +# Whether the TAP plan has been seen or not, and if yes, which kind +# it is ("early" is seen before any test result, "late" otherwise). +my $plan_seen = NO_PLAN; + +# ----------------- # +# Option parsing. # +# ----------------- # + +my %cfg = ( + "color" => 0, + "verbose" => 0, + "show-failures-only" => 0, +); + +my $color = "auto"; +my $test_name = undef; + +# Perl's Getopt::Long allows options to take optional arguments after a space. +# Prevent --color by itself from consuming other arguments +foreach (@ARGV) { + if ($_ eq "--color" || $_ eq "-color") { + $_ = "--color=$color"; + } +} + +Getopt::Long::GetOptions + ( + 'help' => sub { print $HELP; exit 0; }, + 'version' => sub { print "$ME $VERSION\n"; exit 0; }, + 'test-name=s' => \$test_name, + 'color=s' => \$color, + 'show-failures-only' => sub { $cfg{"show-failures-only"} = 1; }, + 'verbose' => sub { $cfg{"verbose"} = 1; }, + ) or exit 1; + +if ($color =~ /^always$/i) { + $cfg{'color'} = 1; +} elsif ($color =~ /^never$/i) { + $cfg{'color'} = 0; +} elsif ($color =~ /^auto$/i) { + $cfg{'color'} = (-t STDOUT); +} else { + die "Invalid color mode: $color\n"; +} + +# ------------- # +# Prototypes. # +# ------------- # + +sub colored ($$); +sub decorate_result ($); +sub extract_tap_comment ($); +sub handle_tap_bailout ($); +sub handle_tap_plan ($); +sub handle_tap_result ($); +sub is_null_string ($); +sub main (); +sub report ($;$); +sub stringify_result_obj ($); +sub testsuite_error ($); + +# -------------- # +# Subroutines. # +# -------------- # + +# If the given string is undefined or empty, return true, otherwise +# return false. This function is useful to avoid pitfalls like: +# if ($message) { print "$message\n"; } +# which wouldn't print anything if $message is the literal "0". +sub is_null_string ($) +{ + my $str = shift; + return ! (defined $str and length $str); +} + +sub stringify_result_obj ($) +{ + my $result_obj = shift; + if ($result_obj->is_unplanned || $result_obj->number != $testno) + { + return "ERROR"; + } + elsif ($plan_seen == LATE_PLAN) + { + return "ERROR"; + } + elsif (!$result_obj->directive) + { + return $result_obj->is_ok ? "PASS" : "FAIL"; + } + elsif ($result_obj->has_todo) + { + return $result_obj->is_actual_ok ? "XPASS" : "XFAIL"; + } + elsif ($result_obj->has_skip) + { + return $result_obj->is_ok ? "SKIP" : "FAIL"; + } + die "$ME: INTERNAL ERROR"; # NOTREACHED +} + +sub colored ($$) +{ + my ($color_string, $text) = @_; + return $color_string . $text . RESET; +} + +sub decorate_result ($) +{ + my $result = shift; + return $result unless $cfg{"color"}; + my %color_for_result = + ( + "ERROR" => BOLD.MAGENTA, + "PASS" => GREEN, + "XPASS" => BOLD.YELLOW, + "FAIL" => BOLD.RED, + "XFAIL" => YELLOW, + "SKIP" => BLUE, + ); + if (my $color = $color_for_result{$result}) + { + return colored ($color, $result); + } + else + { + return $result; # Don't colorize unknown stuff. + } +} + +sub report ($;$) +{ + my ($msg, $result, $explanation) = (undef, @_); + if ($result =~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/) + { + # Output on console might be colorized. + $msg = decorate_result($result); + if ($result =~ /^(?:PASS|XFAIL|SKIP)/) + { + return if $cfg{"show-failures-only"}; + } + else + { + $failed = 1; + } + } + elsif ($result eq "#") + { + $msg = " "; + } + else + { + die "$ME: INTERNAL ERROR"; # NOTREACHED + } + $msg .= " $explanation" if defined $explanation; + print $msg . "\n"; +} + +sub testsuite_error ($) +{ + report "ERROR", "- $_[0]"; +} + +sub handle_tap_result ($) +{ + $testno++; + my $result_obj = shift; + + my $test_result = stringify_result_obj $result_obj; + my $string = $result_obj->number; + + my $description = $result_obj->description; + $string .= " $test_name" unless is_null_string $test_name; + $string .= " $description" unless is_null_string $description; + + if ($plan_seen == LATE_PLAN) + { + $string .= " # AFTER LATE PLAN"; + } + elsif ($result_obj->is_unplanned) + { + $string .= " # UNPLANNED"; + } + elsif ($result_obj->number != $testno) + { + $string .= " # OUT-OF-ORDER (expecting $testno)"; + } + elsif (my $directive = $result_obj->directive) + { + $string .= " # $directive"; + my $explanation = $result_obj->explanation; + $string .= " $explanation" + unless is_null_string $explanation; + } + + report $test_result, $string; +} + +sub handle_tap_plan ($) +{ + my $plan = shift; + if ($plan_seen) + { + # Error, only one plan per stream is acceptable. + testsuite_error "multiple test plans"; + return; + } + # The TAP plan can come before or after *all* the TAP results; we speak + # respectively of an "early" or a "late" plan. If we see the plan line + # after at least one TAP result has been seen, assume we have a late + # plan; in this case, any further test result seen after the plan will + # be flagged as an error. + $plan_seen = ($testno >= 1 ? LATE_PLAN : EARLY_PLAN); + # If $testno > 0, we have an error ("too many tests run") that will be + # automatically dealt with later, so don't worry about it here. If + # $plan_seen is true, we have an error due to a repeated plan, and that + # has already been dealt with above. Otherwise, we have a valid "plan + # with SKIP" specification, and should report it as a particular kind + # of SKIP result. + if ($plan->directive && $testno == 0) + { + my $explanation = is_null_string ($plan->explanation) ? + undef : "- " . $plan->explanation; + report "SKIP", $explanation; + } +} + +sub handle_tap_bailout ($) +{ + my ($bailout, $msg) = ($_[0], "Bail out!"); + $bailed_out = 1; + $msg .= " " . $bailout->explanation + unless is_null_string $bailout->explanation; + testsuite_error $msg; +} + +sub extract_tap_comment ($) +{ + my $line = shift; + if (index ($line, DIAG_STRING) == 0) + { + # Strip leading `DIAG_STRING' from `$line'. + $line = substr ($line, length (DIAG_STRING)); + # And strip any leading and trailing whitespace left. + $line =~ s/(?:^\s*|\s*$)//g; + # Return what is left (if any). + return $line; + } + return ""; +} + +sub main () +{ + my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN); + my $parser = TAP::Parser->new ({iterator => $iterator }); + + while (defined (my $cur = $parser->next)) + { + # Parsing of TAP input should stop after a "Bail out!" directive. + next if $bailed_out; + + if ($cur->is_plan) + { + handle_tap_plan ($cur); + } + elsif ($cur->is_test) + { + handle_tap_result ($cur); + } + elsif ($cur->is_bailout) + { + handle_tap_bailout ($cur); + } + elsif ($cfg{"verbose"}) + { + my $comment = extract_tap_comment ($cur->raw); + report "#", "$comment" if length $comment; + } + } + # A "Bail out!" directive should cause us to ignore any following TAP + # error. + if (!$bailed_out) + { + if (!$plan_seen) + { + testsuite_error "missing test plan"; + } + elsif ($parser->tests_planned != $parser->tests_run) + { + my ($planned, $run) = ($parser->tests_planned, $parser->tests_run); + my $bad_amount = $run > $planned ? "many" : "few"; + testsuite_error (sprintf "too %s tests run (expected %d, got %d)", + $bad_amount, $planned, $run); + } + } +} + +# ----------- # +# Main code. # +# ----------- # + +main; +exit($failed); + +# Local Variables: +# perl-indent-level: 2 +# perl-continued-statement-offset: 2 +# perl-continued-brace-offset: 0 +# perl-brace-offset: 0 +# perl-brace-imaginary-offset: 0 +# perl-label-offset: -2 +# cperl-indent-level: 2 +# cperl-brace-offset: 0 +# cperl-continued-brace-offset: 0 +# cperl-label-offset: -2 +# cperl-extra-newline-before-brace: t +# cperl-merge-trailing-else: nil +# cperl-continued-statement-offset: 2 +# End: diff --git a/scripts/tap-merge.pl b/scripts/tap-merge.pl new file mode 100755 index 0000000..59e3fa5 --- /dev/null +++ b/scripts/tap-merge.pl @@ -0,0 +1,110 @@ +#! /usr/bin/env perl +# Copyright (C) 2018 Red Hat, Inc. +# +# Author: Paolo Bonzini +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# ---------------------------------- # +# Imports, static data, and setup. # +# ---------------------------------- # + +use warnings FATAL => 'all'; +use strict; +use Getopt::Long (); +use TAP::Parser; + +my $ME = "tap-merge.pl"; +my $VERSION = "2018-11-30"; + +my $HELP = "$ME: merge multiple TAP inputs from stdin."; + +use constant DIAG_STRING => "#"; + +# ----------------- # +# Option parsing. # +# ----------------- # + +Getopt::Long::GetOptions + ( + 'help' => sub { print $HELP; exit 0; }, + 'version' => sub { print "$ME $VERSION\n"; exit 0; }, + ); + +# -------------- # +# Subroutines. # +# -------------- # + +sub main () +{ + my $iterator = TAP::Parser::Iterator::Stream->new(\*STDIN); + my $parser = TAP::Parser->new ({iterator => $iterator }); + my $testno = 0; # Number of test results seen so far. + my $bailed_out = 0; # Whether a "Bail out!" directive has been seen. + + while (defined (my $cur = $parser->next)) + { + if ($cur->is_bailout) + { + $bailed_out = 1; + print DIAG_STRING . " " . $cur->as_string . "\n"; + next; + } + elsif ($cur->is_plan) + { + $bailed_out = 0; + next; + } + elsif ($cur->is_test) + { + $bailed_out = 0 if $cur->number == 1; + $testno++; + $cur = TAP::Parser::Result::Test->new({ + ok => $cur->ok, + test_num => $testno, + directive => $cur->directive, + explanation => $cur->explanation, + description => $cur->description + }); + } + elsif ($cur->is_version) + { + next if $testno > 0; + } + print $cur->as_string . "\n" unless $bailed_out; + } + print "1..$testno\n"; +} + +# ----------- # +# Main code. # +# ----------- # + +main; + +# Local Variables: +# perl-indent-level: 2 +# perl-continued-statement-offset: 2 +# perl-continued-brace-offset: 0 +# perl-brace-offset: 0 +# perl-brace-imaginary-offset: 0 +# perl-label-offset: -2 +# cperl-indent-level: 2 +# cperl-brace-offset: 0 +# cperl-continued-brace-offset: 0 +# cperl-label-offset: -2 +# cperl-extra-newline-before-brace: t +# cperl-merge-trailing-else: nil +# cperl-continued-statement-offset: 2 +# End: diff --git a/tests/Makefile.include b/tests/Makefile.include index fb0b449..62915e4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -799,41 +799,53 @@ tests/test-qga$(EXESUF): qemu-ga$(EXESUF) tests/test-qga$(EXESUF): tests/test-qga.o $(qtest-obj-y) SPEED = quick -GTESTER_OPTIONS = -k $(if $(V),--verbose,-q) -GCOV_OPTIONS = -n $(if $(V),-f,) # gtester tests, possibly with verbose output +# do_test_tap runs all tests, even if some of them fail, while do_test_human +# stops at the first failure unless -k is given on the command line + +do_test_human = \ + $(call quiet-command, rc=0; \ + { $(foreach COMMAND, $1, \ + MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ + $2 $(COMMAND) -m=$(SPEED) -k --tap \ + | ./scripts/tap-driver.pl --test-name="$(notdir $(COMMAND))" --color=always $(if $(V),, --show-failures-only) \ + || $(if $(findstring k, $(MAKEFLAGS)), rc=$$?, exit $$?); ) }; exit $$rc, \ + "TEST", "$@") + +do_test_tap = \ + $(call quiet-command, \ + { $(foreach COMMAND, $1, \ + MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ + $2 $(COMMAND) -m=$(SPEED) -k --tap | sed "s/^[a-z][a-z]* [0-9]* /&$(notdir $(COMMAND)) /" || true; ) } \ + | ./scripts/tap-merge.pl | tee "$@" \ + | ./scripts/tap-driver.pl --color=always $(if $(V),, --show-failures-only), \ + "TAP","$@") .PHONY: $(patsubst %, check-qtest-%, $(QTEST_TARGETS)) $(patsubst %, check-qtest-%, $(QTEST_TARGETS)): check-qtest-%: subdir-%-softmmu $(check-qtest-y) - $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ - QTEST_QEMU_IMG=qemu-img$(EXESUF) \ - MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@") + $(call do_test_human,$(check-qtest-$*-y) $(check-qtest-generic-y), \ + QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ + QTEST_QEMU_IMG=qemu-img$(EXESUF)) .PHONY: $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)) $(patsubst %, check-%, $(check-unit-y) $(check-speed-y)): check-%: % - $(call quiet-command, \ - MALLOC_PERTURB_=$${MALLOC_PERTURB_:-$$(( $${RANDOM:-0} % 255 + 1))} \ - gtester $(GTESTER_OPTIONS) -m=$(SPEED) $*,"GTESTER","$*") + $(call do_test_human, $*) -# gtester tests with XML output +# gtester tests with TAP output -$(patsubst %, check-report-qtest-%.xml, $(QTEST_TARGETS)): check-report-qtest-%.xml: $(check-qtest-y) - $(call quiet-command,QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ - QTEST_QEMU_IMG=qemu-img$(EXESUF) \ - gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $(check-qtest-$*-y) $(check-qtest-generic-y),"GTESTER","$@") +$(patsubst %, check-report-qtest-%.tap, $(QTEST_TARGETS)): check-report-qtest-%.tap: $(check-qtest-y) + $(call do_test_tap, $(check-qtest-$*-y) $(check-qtest-generic-y), \ + QTEST_QEMU_BINARY=$*-softmmu/qemu-system-$* \ + QTEST_QEMU_IMG=qemu-img$(EXESUF)) -check-report-unit.xml: $(check-unit-y) - $(call quiet-command,gtester -q $(GTESTER_OPTIONS) -o $@ -m=$(SPEED) $^,"GTESTER","$@") +check-report-unit.tap: $(check-unit-y) + $(call do_test_tap,$^) # Reports and overall runs -check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check-report-unit.xml - $(call quiet-command,$(SRC_PATH)/scripts/gtester-cat $^ > $@,"GEN","$@") - -check-report.html: check-report.xml - $(call quiet-command,gtester-report $< > $@,"GEN","$@") +check-report.tap: $(patsubst %,check-report-qtest-%.tap, $(QTEST_TARGETS)) check-report-unit.tap + $(call quiet-command,./scripts/tap-merge.py $^ > $@,"GEN","$@") # Per guest TCG tests diff --git a/tests/docker/dockerfiles/centos7.docker b/tests/docker/dockerfiles/centos7.docker index 0a04bfb..e0f18f5 100644 --- a/tests/docker/dockerfiles/centos7.docker +++ b/tests/docker/dockerfiles/centos7.docker @@ -22,6 +22,7 @@ ENV PACKAGES \ mesa-libEGL-devel \ mesa-libgbm-devel \ nettle-devel \ + perl-Test-Harness \ pixman-devel \ SDL-devel \ spice-glib-devel \ diff --git a/tests/docker/dockerfiles/debian-amd64.docker b/tests/docker/dockerfiles/debian-amd64.docker index 24b113b..c66e341 100644 --- a/tests/docker/dockerfiles/debian-amd64.docker +++ b/tests/docker/dockerfiles/debian-amd64.docker @@ -16,6 +16,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ liblzo2-dev \ librdmacm-dev \ libsnappy-dev \ + libtest-harness-perl \ libvte-dev # virgl diff --git a/tests/docker/dockerfiles/debian-ports.docker b/tests/docker/dockerfiles/debian-ports.docker index e05a9a9..514ab53 100644 --- a/tests/docker/dockerfiles/debian-ports.docker +++ b/tests/docker/dockerfiles/debian-ports.docker @@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/debian-sid.docker b/tests/docker/dockerfiles/debian-sid.docker index 9a3d168..b30cbe7 100644 --- a/tests/docker/dockerfiles/debian-sid.docker +++ b/tests/docker/dockerfiles/debian-sid.docker @@ -26,6 +26,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ ca-certificates \ flex \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/debian8.docker b/tests/docker/dockerfiles/debian8.docker index 5294563..cdc3f11 100644 --- a/tests/docker/dockerfiles/debian8.docker +++ b/tests/docker/dockerfiles/debian8.docker @@ -29,6 +29,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ gettext \ git \ gnupg \ + libtest-harness-perl \ pkg-config \ python-minimal diff --git a/tests/docker/dockerfiles/debian9.docker b/tests/docker/dockerfiles/debian9.docker index 154ae2a..9561d4f 100644 --- a/tests/docker/dockerfiles/debian9.docker +++ b/tests/docker/dockerfiles/debian9.docker @@ -24,6 +24,7 @@ RUN DEBIAN_FRONTEND=noninteractive eatmydata \ flex \ gettext \ git \ + libtest-harness-perl \ pkg-config \ psmisc \ python \ diff --git a/tests/docker/dockerfiles/fedora.docker b/tests/docker/dockerfiles/fedora.docker index 0c4eb9e..1d0e3dc 100644 --- a/tests/docker/dockerfiles/fedora.docker +++ b/tests/docker/dockerfiles/fedora.docker @@ -70,6 +70,7 @@ ENV PACKAGES \ nss-devel \ numactl-devel \ perl \ + perl-Test-Harness \ pixman-devel \ python3 \ PyYAML \ diff --git a/tests/docker/dockerfiles/ubuntu.docker b/tests/docker/dockerfiles/ubuntu.docker index 36e2b17..229add5 100644 --- a/tests/docker/dockerfiles/ubuntu.docker +++ b/tests/docker/dockerfiles/ubuntu.docker @@ -45,6 +45,7 @@ ENV PACKAGES flex bison \ libspice-protocol-dev \ libspice-server-dev \ libssh2-1-dev \ + libtest-harness-perl \ libusb-1.0-0-dev \ libusbredirhost-dev \ libvdeplug-dev \ From patchwork Wed Dec 12 15:22:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726571 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 B4686174F for ; Wed, 12 Dec 2018 15:37:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4CD42873D for ; Wed, 12 Dec 2018 15:37:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 98F4828791; Wed, 12 Dec 2018 15:37:33 +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 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 46E692873D for ; Wed, 12 Dec 2018 15:37:33 +0000 (UTC) Received: from localhost ([::1]:45628 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Zo-0002m6-Dt for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:37:32 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000qD-Bt for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000FY-05 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:38477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0000B2-Fg for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x434.google.com with SMTP id v13so18110137wrw.5 for ; Wed, 12 Dec 2018 07:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KobekzsIYNm2uErAL3Xuxn2uj9kQJAImsV1s69KEobU=; b=IBC8kvdYhIouEdebkDiZUr1CWflKSMMEvrrkiDZLGRLm3gW1nmNZR6FsafLzdlUitF 8mHQ/BA3FYvuSwENAMFnWNotHgNDgiKwpoZSnNF23wkrENe04PHp64tt7ycaIOblLflI l2llpoQF0ftmm6Iq0QbY09J9PPNnYU3TQlSCbZRc8iUnj+KFvGtqEPhKqtTWfsW+1SZe p00RdPZUXLUZvEVZ0aL9QZXD9KxTvXqfmWJCFGZPbWz5WnSZO3z4QlxCfZzUfk2Sc9AB QFAxSHGhp11E5mG/8wImn72rNItKt6bVJk9YCyOzxxzeTgCsqwsYfOFhVqvp6yr1ZdGr I81w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=KobekzsIYNm2uErAL3Xuxn2uj9kQJAImsV1s69KEobU=; b=Sa4qMlOxVmvKJcwlmjfvKpMw+otcSob1kqFE6ydspHaY2LgMhu0Asgkywh8rf/3YqE /+TF6mYTSi4NpYYZ5hCE+QUKQdWsAV44biARC1z7w5NBcuYr2yULrkLp9barQ/lGLHfp y/Tu9NC1DMuic9JSbcg8xYx4x8DF6X1ajGn1Bcpnr3moer1nLWB4IA7lp08Rc/dTeeZK HSk16+kvBtloGJbpouQAce4hYFS6X/sJIhDdm6ylhhxqeXN31dgHz4FdgrVH+X76UXWR 3EBqTKXxCGN8OAV54n/ot0XY70UbMOsuecstB2rqoHSFOn9Y0TwLQ5TiMx/lXRH+brOR v0nA== X-Gm-Message-State: AA+aEWZt9Us1GIkfaIAi4x6Hy0EPqij8YUIdUs5X3d8ipKbu8qQjqo2w JaNdS1K3cG/rMNeJKBaucD7DM3X/ X-Google-Smtp-Source: AFSGD/V+IwYSgl+uA/RpA7Z0AWQuG31Ukhe6KbJdEfIckZ4XuIdHPaQ5hclyVS00YpySly16NJzo+w== X-Received: by 2002:adf:f149:: with SMTP id y9mr19186651wro.284.1544628224257; Wed, 12 Dec 2018 07:23:44 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:43 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:45 +0100 Message-Id: <1544628195-37728-25-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 Subject: [Qemu-devel] [PULL 24/54] compiler.h: Add an explicit check for the compiler version 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth The questions about our minimum compiler requirement pops up every couple of months, and we then have to recall the details each time. So let's document this in a proper way, by adding a comment and check for the right compiler version to our compiler.h header. Signed-off-by: Thomas Huth Message-Id: <1543574620-17506-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- include/qemu/compiler.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 6b92710..6f32ec2 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -22,6 +22,14 @@ # define QEMU_GNUC_PREREQ(maj, min) 0 #endif +/* + * We need at least GCC 4.1 for atomics support. Clang also supports these, + * and reports itself as GCC 4.2, so it passes this check, too. + */ +#if !QEMU_GNUC_PREREQ(4, 1) +#error QEMU needs a compiler that is compatible with GCC v4.1 or newer +#endif + #define QEMU_NORETURN __attribute__ ((__noreturn__)) #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) From patchwork Wed Dec 12 15:22:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726575 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 2923A16B1 for ; Wed, 12 Dec 2018 15:37:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 192032808F for ; Wed, 12 Dec 2018 15:37:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0DCF72862D; Wed, 12 Dec 2018 15:37:49 +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 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 AF8102808F for ; Wed, 12 Dec 2018 15:37:48 +0000 (UTC) Received: from localhost ([::1]:45634 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6a3-00042L-S9 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:37:47 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000q7-9x for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MX-0000FH-Qt for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:44112) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0000Be-Bs for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x42a.google.com with SMTP id z5so18064080wrt.11 for ; Wed, 12 Dec 2018 07:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+q+fHBwW9gdjsQOj6mbhPhw4bD7LXA1ifIXgVZiRo7A=; b=Hv5eL/MiEyrhYkhe6qWO9kKT367q9SjdoTFOhri0tlRnWbAeBkPjDxGAAVGktG2Zrk RZ3NZS4DBVXPr+1CTH2IulGW/CQFqRRS0JG7QPr1cncEYDsnN7L9/zU4fdddMksHinUd Ni6Pp0T4OxSxx2GDtuA+rM1C8awAOUMhLMgFe/eQkvpuIcesQYXEkym4zi7ym7KmyZRM hRHFSGZUV4iJoESs9vLxdIlmC7Hw3XuqDQndxYhGm/F9IB6raD85PbZUz0ZFCoqiQBpa 2BrgDSaP628/rnqzYvyX+IUMCtbipLPfUcl6nZqpeiqKz+y/+EaoTEufYJx3muOW5D9T clMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=+q+fHBwW9gdjsQOj6mbhPhw4bD7LXA1ifIXgVZiRo7A=; b=Wl98OXEC4g/i9W3f8xfRS0N2cO9T1RAWz8RfkeHMAbx8ivGpps8NjoeBQfwGiH+MpR ido6//osMcBJDTQ0CS5oGojNp+y7jY2s/XoImhqMKXHOsULzPaWVg0y6/N2zk8L1ompe jrFkHeiYg3vsqRdM2Llr0QXwCtCDCzFC9CN01vwha19z8hcwI7D9Fg640G2lMYS33p5N 19GH1/BQV9xgvB0EeWW3X+TDIQuThks5GDkbJo/JzSF0QUqLElAP7h+BIDwf60t3s+hk ypuyFhCkl6cJivZAdmL1pl5yieDDFeE2yPbGAP2BMYiMn+kgf1/05H1fmGM1OHsIUbdu /QZA== X-Gm-Message-State: AA+aEWYute5T+JT26j392OECYAbvLcaKeUrm+1YCotjIa4iOjUfhknRb y4RrSBJeHi3ruojzHW3Y9MzNZbZp X-Google-Smtp-Source: AFSGD/W/g0LYu0qwRblFFvV8pY2OgdJLXDEQwMOjvKZMu5Th/CmWNpeCPBRdx2w9q3LBBpaAwY3rDw== X-Received: by 2002:a5d:660e:: with SMTP id n14mr17368051wru.19.1544628225170; Wed, 12 Dec 2018 07:23:45 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:44 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:46 +0100 Message-Id: <1544628195-37728-26-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42a Subject: [Qemu-devel] [PULL 25/54] qemu/queue.h: do not access tqe_prev directly 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the QTAILQ_IN_USE macro instead, it does the same thing but the next patch will change it to a different definition. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- blockdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockdev.c b/blockdev.c index 81f95d9..7604b21 100644 --- a/blockdev.c +++ b/blockdev.c @@ -4259,7 +4259,7 @@ void qmp_blockdev_del(const char *node_name, Error **errp) goto out; } - if (!bs->monitor_list.tqe_prev) { + if (!QTAILQ_IN_USE(bs, monitor_list)) { error_setg(errp, "Node %s is not owned by the monitor", bs->node_name); goto out; From patchwork Wed Dec 12 15:22:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726581 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 AA6673E9D for ; Wed, 12 Dec 2018 15:40:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9C8D72AF6B for ; Wed, 12 Dec 2018 15:40:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 910FF2B15D; Wed, 12 Dec 2018 15:40:51 +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 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 404C42B1AE for ; Wed, 12 Dec 2018 15:40:51 +0000 (UTC) Received: from localhost ([::1]:45651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6d0-0006oC-FB for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:40:50 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6MZ-0000qR-JE for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000Fd-0m for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:33923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0000CR-J3 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:49 -0500 Received: by mail-wr1-x42d.google.com with SMTP id j2so18126715wrw.1 for ; Wed, 12 Dec 2018 07:23:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=w1ktP9NxHWVMYQyBMXY8XYdqqIe0z8644XEAj9LTTkY=; b=isVQgtF5ko8vobvVeTfvyM+U6UHRTb/c7l8o6nntrpF33aggC/KLjsxLKaLtSYWyvz zm2b4SNYH9sqKJzp0Oq5uIHVAN66yKBAneIqQeiz0NaaP1fCWXNfnUYTYX4LWUSUPsaj CRGnpyy+5u3xoyiaMlTdn1a66BByXg8hZCIiXcADj22U8ffTzIcx88SVNa6CMzsjjpDD xIWrPbmIAXPHAr2CLyT/kN3U0k6ZvnuVGsVxJXr16idYQTKDn/JlszotcDjxXOucismi yyduisnNXwxHh4NSsHQziwPX2FyB0/vfeHhHjU4kee6dBXW7ja4NtDSM3DKSkndgpIpC byMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=w1ktP9NxHWVMYQyBMXY8XYdqqIe0z8644XEAj9LTTkY=; b=gOU30Y6SSVVg3s1yU3Ez/x4np/REk0+KsiBS1RQam5PCLX3PphRf0GxrzbDrgVE8iT 8UkHu2ps5vDAVkUr6D67u9ep6qm7M2e38IVMTtXRiilJ6QY2TSgCPjXKaDR7vVGlhCvY +YMM+xst+kIvc7gAVkLsLcFCqGmaMu6mpFqx7dCANHLjpSrHyhdHZ+/xhADVAtdsa/Tv 5oDrs9zPwoiW2hAlycBbYOfDKd6VY83oYNmpgwAM0ab+UDEmRQ4XSZqpWwr+FT6MgPUP tphzYI8JVs2oANArCm9AuOXnDBjxlWz1yOZ8KKj/9lEWecynM+lLyoxEF0HP1OeLvfHh aLEQ== X-Gm-Message-State: AA+aEWYsBSQAqnOcFA0YKlL8BkCveDPiqQ1F/+JES2DK4T0FZkJw3YMT PyOS4M8VEDIlnfSQdUvo8+1NPpyX X-Google-Smtp-Source: AFSGD/W3cXKupL+3kVqgCrKqqPMjy5cx8gkqxqFe5weRrzZZzyEL4BMWZQVUq9QoDAGR75ERHqfIOA== X-Received: by 2002:adf:eb45:: with SMTP id u5mr16719856wrn.102.1544628226266; Wed, 12 Dec 2018 07:23:46 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:45 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:47 +0100 Message-Id: <1544628195-37728-27-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42d Subject: [Qemu-devel] [PULL 26/54] vfio: make vfio_address_spaces static 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP It is not used outside hw/vfio/common.c, so it does not need to be extern. Acked-by: Alex Williamson Signed-off-by: Paolo Bonzini --- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7c185e5a..7aa804e 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -39,7 +39,7 @@ struct vfio_group_head vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); -struct vfio_as_head vfio_address_spaces = +static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); #ifdef CONFIG_KVM diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 1b434d0..127ca47 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -181,7 +181,6 @@ int vfio_get_device(VFIOGroup *group, const char *name, extern const MemoryRegionOps vfio_region_ops; extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; -extern QLIST_HEAD(vfio_as_head, VFIOAddressSpace) vfio_address_spaces; #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, From patchwork Wed Dec 12 15:22:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726623 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 AB20A14BD for ; Wed, 12 Dec 2018 15:52:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 97C852B216 for ; Wed, 12 Dec 2018 15:52:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C54B2B45F; Wed, 12 Dec 2018 15:52:02 +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 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 0EF162B216 for ; Wed, 12 Dec 2018 15:52:00 +0000 (UTC) Received: from localhost ([::1]:45710 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6nn-0007f0-TR for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:51:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52510) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mg-0000y7-5D for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000GQ-Hw for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:38509) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MX-0000Dj-VD for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m22so6400258wml.3 for ; Wed, 12 Dec 2018 07:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=p5JVDBfwzF784Lb8G82dIC/qk0XXS74lPcjRMnP7rW0=; b=om3EG/WuNpP34w67PA8wLvXfFWFxJV031Hjn04nbxwX57TFto6fpYGLTceloIHHSTO 61jkmp/RFqLtgEx01mHhhSuqOLkibNchgK6NBTggUKAEPxoUqjTDXnLvf2K7JWDOPp0k ktXMEc6ZTXbGMI0jL2LxzDl7I65f9RBdhQ5aSPc80mCviTUz+cuvYXhxHEgg7/8j7O/E TFZ6dsh1YsVOoPuXAxxlv7qV9TYoNZRxEFvct2BHIrYjQMeUl8YiRSa4Or9C5vdgi7oj L4gR6M2bor1ijRzR4ecrvG1IPmTMh893eH1Pfz3aA0ACpuB3oMY2koiaMFYjPEOkgvYL AhNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=p5JVDBfwzF784Lb8G82dIC/qk0XXS74lPcjRMnP7rW0=; b=lksxY3cO7zHznb/bmjOIlrvCAH8OIUcOE9etacukHxQzjoDVJjqmFGYQRHjtTfZe0u HMCorwolWpZFVh9aYZUddi+T8gYkgSte0l6gGbykfmpqf84gbd/GgQUX9WROCov2p3HX OjKs6/Rv+/Dn8W6/OLp2DFKzkx5Sk2DsdV8wgvO+Xl49RBXMPIzRXP0ZgnbPCFKNGwGY fOqJOWOscO/YJeJUAnXM1bK6jH/MAUOt+spLhAbDr1gcn82N15JEkIY46SiJAVFFU+/l VwtlQUrPGzgSkikJhBZalFIuuDWbPaXfybfEfKEB6uStrr2BTI6jKNAjHg1SpjWIFnWD UVwA== X-Gm-Message-State: AA+aEWYU71JguwsvWyHxlsbDSvImDsiAm773iX62J+I+6BQk2FTOhKJQ jQS3tx5TY07RCEt4NZXizuO8uDp5 X-Google-Smtp-Source: AFSGD/XnKcqLT1n0PzasBv090AjYW6KtJT8OaQ0XPeDMlf3gIiC1wLzuH8a+LDs7PAzfWvSjr+j2IQ== X-Received: by 2002:a1c:e488:: with SMTP id b130mr6883507wmh.124.1544628227709; Wed, 12 Dec 2018 07:23:47 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:46 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:48 +0100 Message-Id: <1544628195-37728-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32c Subject: [Qemu-devel] [PULL 27/54] qemu/queue.h: leave head structs anonymous unless necessary 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Most list head structs need not be given a name. In most cases the name is given just in case one is going to use QTAILQ_LAST, QTAILQ_PREV or reverse iteration, but this does not apply to lists of other kinds, and even for QTAILQ in practice this is only rarely needed. In addition, we will soon reimplement those macros completely so that they do not need a name for the head struct. So clean up everything, not giving a name except in the rare case where it is necessary. Signed-off-by: Paolo Bonzini --- accel/kvm/kvm-all.c | 4 ++-- block/gluster.c | 2 +- block/mirror.c | 2 +- block/qcow2-bitmap.c | 4 +--- block/qcow2.h | 2 +- block/sheepdog.c | 6 +++--- block/vhdx.h | 2 +- blockdev.c | 2 +- contrib/ivshmem-client/ivshmem-client.h | 4 +--- contrib/ivshmem-server/ivshmem-server.h | 5 +---- exec.c | 2 +- fsdev/qemu-fsdev.c | 2 +- hw/block/nvme.h | 8 ++++---- hw/block/xen_disk.c | 6 +++--- hw/core/reset.c | 2 +- hw/i386/xen/xen-mapcache.c | 2 +- hw/ppc/spapr_iommu.c | 2 +- hw/usb/ccid-card-emulated.c | 4 ++-- hw/usb/dev-network.c | 2 +- hw/usb/xen-usb.c | 6 +++--- hw/watchdog/watchdog.c | 2 +- hw/xen/xen_pvdev.c | 4 ++-- include/exec/memory.h | 4 ++-- include/hw/vfio/vfio-platform.h | 2 +- include/qom/cpu.h | 4 ++-- include/sysemu/kvm.h | 2 -- include/sysemu/rng.h | 2 +- linux-user/elfload.c | 2 +- memory.c | 2 +- migration/block-dirty-bitmap.c | 2 +- migration/block.c | 4 ++-- migration/ram.c | 2 +- monitor.c | 4 ++-- net/queue.c | 2 +- net/slirp.c | 2 +- slirp/slirp.c | 2 +- target/arm/kvm.c | 2 +- target/i386/hax-mem.c | 2 +- tcg/tcg.h | 2 +- tests/test-rcu-list.c | 2 +- vl.c | 2 +- 41 files changed, 56 insertions(+), 65 deletions(-) diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 4880a05..4e1de94 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -86,7 +86,7 @@ struct KVMState int robust_singlestep; int debugregs; #ifdef KVM_CAP_SET_GUEST_DEBUG - struct kvm_sw_breakpoint_head kvm_sw_breakpoints; + QTAILQ_HEAD(, kvm_sw_breakpoint) kvm_sw_breakpoints; #endif int many_ioeventfds; int intx_set_mask; @@ -102,7 +102,7 @@ struct KVMState int nr_allocated_irq_routes; unsigned long *used_gsi_bitmap; unsigned int gsi_count; - QTAILQ_HEAD(msi_hashtab, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; + QTAILQ_HEAD(, KVMMSIRoute) msi_hashtab[KVM_MSI_HASHTAB_SIZE]; #endif KVMMemoryListener memory_listener; QLIST_HEAD(, KVMParkedVcpu) kvm_parked_vcpus; diff --git a/block/gluster.c b/block/gluster.c index 5e300c9..7289106 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -72,7 +72,7 @@ typedef struct ListElement { GlfsPreopened saved; } ListElement; -static QLIST_HEAD(glfs_list, ListElement) glfs_list; +static QLIST_HEAD(, ListElement) glfs_list; static QemuOptsList qemu_gluster_create_opts = { .name = "qemu-gluster-create-opts", diff --git a/block/mirror.c b/block/mirror.c index 8f52c62..6250cc3 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -72,7 +72,7 @@ typedef struct MirrorBlockJob { unsigned long *in_flight_bitmap; int in_flight; int64_t bytes_in_flight; - QTAILQ_HEAD(MirrorOpList, MirrorOp) ops_in_flight; + QTAILQ_HEAD(, MirrorOp) ops_in_flight; int ret; bool unmap; int target_cluster_size; diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index accebef..b946301 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -77,8 +77,6 @@ typedef struct Qcow2BitmapTable { uint32_t size; /* number of 64bit entries */ QSIMPLEQ_ENTRY(Qcow2BitmapTable) entry; } Qcow2BitmapTable; -typedef QSIMPLEQ_HEAD(Qcow2BitmapTableList, Qcow2BitmapTable) - Qcow2BitmapTableList; typedef struct Qcow2Bitmap { Qcow2BitmapTable table; @@ -1316,7 +1314,7 @@ void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp) int ret; Qcow2BitmapList *bm_list; Qcow2Bitmap *bm; - Qcow2BitmapTableList drop_tables; + QSIMPLEQ_HEAD(, Qcow2BitmapTable) drop_tables; Qcow2BitmapTable *tb, *tb_next; if (!bdrv_has_changed_persistent_bitmaps(bs)) { diff --git a/block/qcow2.h b/block/qcow2.h index 8662b68..d747dd1 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -281,7 +281,7 @@ typedef struct BDRVQcow2State { uint8_t *cluster_cache; uint8_t *cluster_data; uint64_t cluster_cache_offset; - QLIST_HEAD(QCowClusterAlloc, QCowL2Meta) cluster_allocs; + QLIST_HEAD(, QCowL2Meta) cluster_allocs; uint64_t *refcount_table; uint64_t refcount_table_offset; diff --git a/block/sheepdog.c b/block/sheepdog.c index 0125df9..90ab43b 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -391,12 +391,12 @@ struct BDRVSheepdogState { uint32_t aioreq_seq_num; /* Every aio request must be linked to either of these queues. */ - QLIST_HEAD(inflight_aio_head, AIOReq) inflight_aio_head; - QLIST_HEAD(failed_aio_head, AIOReq) failed_aio_head; + QLIST_HEAD(, AIOReq) inflight_aio_head; + QLIST_HEAD(, AIOReq) failed_aio_head; CoMutex queue_lock; CoQueue overlapping_queue; - QLIST_HEAD(inflight_aiocb_head, SheepdogAIOCB) inflight_aiocb_head; + QLIST_HEAD(, SheepdogAIOCB) inflight_aiocb_head; }; typedef struct BDRVSheepdogReopenState { diff --git a/block/vhdx.h b/block/vhdx.h index 3a5f529..1bfb4e4 100644 --- a/block/vhdx.h +++ b/block/vhdx.h @@ -398,7 +398,7 @@ typedef struct BDRVVHDXState { bool log_replayed_on_open; - QLIST_HEAD(VHDXRegionHead, VHDXRegionEntry) regions; + QLIST_HEAD(, VHDXRegionEntry) regions; } BDRVVHDXState; void vhdx_guid_generate(MSGUID *guid); diff --git a/blockdev.c b/blockdev.c index 7604b21..60d05ec 100644 --- a/blockdev.c +++ b/blockdev.c @@ -2269,7 +2269,7 @@ void qmp_transaction(TransactionActionList *dev_list, BlkActionState *state, *next; Error *local_err = NULL; - QSIMPLEQ_HEAD(snap_bdrv_states, BlkActionState) snap_bdrv_states; + QSIMPLEQ_HEAD(, BlkActionState) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); /* Does this transaction get canceled as a group on failure? diff --git a/contrib/ivshmem-client/ivshmem-client.h b/contrib/ivshmem-client/ivshmem-client.h index 5ee9422..fe3cc4a 100644 --- a/contrib/ivshmem-client/ivshmem-client.h +++ b/contrib/ivshmem-client/ivshmem-client.h @@ -46,9 +46,7 @@ typedef struct IvshmemClientPeer { int vectors[IVSHMEM_CLIENT_MAX_VECTORS]; /**< one fd per vector */ unsigned vectors_count; /**< number of vectors */ } IvshmemClientPeer; -QTAILQ_HEAD(IvshmemClientPeerList, IvshmemClientPeer); -typedef struct IvshmemClientPeerList IvshmemClientPeerList; typedef struct IvshmemClient IvshmemClient; /** @@ -73,7 +71,7 @@ struct IvshmemClient { int sock_fd; /**< unix sock filedesc */ int shm_fd; /**< shm file descriptor */ - IvshmemClientPeerList peer_list; /**< list of peers */ + QTAILQ_HEAD(, IvshmemClientPeer) peer_list; /**< list of peers */ IvshmemClientPeer local; /**< our own infos */ IvshmemClientNotifCb notif_cb; /**< notification callback */ diff --git a/contrib/ivshmem-server/ivshmem-server.h b/contrib/ivshmem-server/ivshmem-server.h index 4af08e1..d870adb 100644 --- a/contrib/ivshmem-server/ivshmem-server.h +++ b/contrib/ivshmem-server/ivshmem-server.h @@ -52,9 +52,6 @@ typedef struct IvshmemServerPeer { EventNotifier vectors[IVSHMEM_SERVER_MAX_VECTORS]; /**< one per vector */ unsigned vectors_count; /**< number of vectors */ } IvshmemServerPeer; -QTAILQ_HEAD(IvshmemServerPeerList, IvshmemServerPeer); - -typedef struct IvshmemServerPeerList IvshmemServerPeerList; /** * Structure describing an ivshmem server @@ -72,7 +69,7 @@ typedef struct IvshmemServer { unsigned n_vectors; /**< number of vectors */ uint16_t cur_id; /**< id to be given to next client */ bool verbose; /**< true in verbose mode */ - IvshmemServerPeerList peer_list; /**< list of peers */ + QTAILQ_HEAD(, IvshmemServerPeer) peer_list; /**< list of peers */ } IvshmemServer; /** diff --git a/exec.c b/exec.c index bb6170d..b6b2007 100644 --- a/exec.c +++ b/exec.c @@ -3464,7 +3464,7 @@ typedef struct MapClient { } MapClient; QemuMutex map_client_list_lock; -static QLIST_HEAD(map_client_list, MapClient) map_client_list +static QLIST_HEAD(, MapClient) map_client_list = QLIST_HEAD_INITIALIZER(map_client_list); static void cpu_unregister_map_client_do(MapClient *client) diff --git a/fsdev/qemu-fsdev.c b/fsdev/qemu-fsdev.c index 7a3b87c..82edf43 100644 --- a/fsdev/qemu-fsdev.c +++ b/fsdev/qemu-fsdev.c @@ -18,7 +18,7 @@ #include "qemu/error-report.h" #include "qemu/option.h" -static QTAILQ_HEAD(FsDriverEntry_head, FsDriverListEntry) fsdriver_entries = +static QTAILQ_HEAD(, FsDriverListEntry) fsdriver_entries = QTAILQ_HEAD_INITIALIZER(fsdriver_entries); static FsDriverTable FsDrivers[] = { diff --git a/hw/block/nvme.h b/hw/block/nvme.h index cabcf20..56c9d4b 100644 --- a/hw/block/nvme.h +++ b/hw/block/nvme.h @@ -29,8 +29,8 @@ typedef struct NvmeSQueue { uint64_t dma_addr; QEMUTimer *timer; NvmeRequest *io_req; - QTAILQ_HEAD(sq_req_list, NvmeRequest) req_list; - QTAILQ_HEAD(out_req_list, NvmeRequest) out_req_list; + QTAILQ_HEAD(, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeRequest) out_req_list; QTAILQ_ENTRY(NvmeSQueue) entry; } NvmeSQueue; @@ -45,8 +45,8 @@ typedef struct NvmeCQueue { uint32_t size; uint64_t dma_addr; QEMUTimer *timer; - QTAILQ_HEAD(sq_list, NvmeSQueue) sq_list; - QTAILQ_HEAD(cq_req_list, NvmeRequest) req_list; + QTAILQ_HEAD(, NvmeSQueue) sq_list; + QTAILQ_HEAD(, NvmeRequest) req_list; } NvmeCQueue; typedef struct NvmeNamespace { diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 36eff94..2a254b9 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -82,9 +82,9 @@ struct XenBlkDev { int more_work; /* request lists */ - QLIST_HEAD(inflight_head, ioreq) inflight; - QLIST_HEAD(finished_head, ioreq) finished; - QLIST_HEAD(freelist_head, ioreq) freelist; + QLIST_HEAD(, ioreq) inflight; + QLIST_HEAD(, ioreq) finished; + QLIST_HEAD(, ioreq) freelist; int requests_total; int requests_inflight; int requests_finished; diff --git a/hw/core/reset.c b/hw/core/reset.c index 84c8869..9c477f2 100644 --- a/hw/core/reset.c +++ b/hw/core/reset.c @@ -35,7 +35,7 @@ typedef struct QEMUResetEntry { void *opaque; } QEMUResetEntry; -static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers = +static QTAILQ_HEAD(, QEMUResetEntry) reset_handlers = QTAILQ_HEAD_INITIALIZER(reset_handlers); void qemu_register_reset(QEMUResetHandler *func, void *opaque) diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c index 4e4f069..02e823c 100644 --- a/hw/i386/xen/xen-mapcache.c +++ b/hw/i386/xen/xen-mapcache.c @@ -71,7 +71,7 @@ typedef struct MapCacheRev { typedef struct MapCache { MapCacheEntry *entry; unsigned long nr_buckets; - QTAILQ_HEAD(map_cache_head, MapCacheRev) locked_entries; + QTAILQ_HEAD(, MapCacheRev) locked_entries; /* For most cases (>99.9%), the page address is the same. */ MapCacheEntry *last_entry; diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c index 1b0880a..68dacf6 100644 --- a/hw/ppc/spapr_iommu.c +++ b/hw/ppc/spapr_iommu.c @@ -42,7 +42,7 @@ enum sPAPRTCEAccess { #define IOMMU_PAGE_SIZE(shift) (1ULL << (shift)) #define IOMMU_PAGE_MASK(shift) (~(IOMMU_PAGE_SIZE(shift) - 1)) -static QLIST_HEAD(spapr_tce_tables, sPAPRTCETable) spapr_tce_tables; +static QLIST_HEAD(, sPAPRTCETable) spapr_tce_tables; sPAPRTCETable *spapr_tce_find_by_liobn(target_ulong liobn) { diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 25976ed..de880a8 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -119,11 +119,11 @@ struct EmulatedState { char *db; uint8_t atr[MAX_ATR_SIZE]; uint8_t atr_length; - QSIMPLEQ_HEAD(event_list, EmulEvent) event_list; + QSIMPLEQ_HEAD(, EmulEvent) event_list; QemuMutex event_list_mutex; QemuThread event_thread_id; VReader *reader; - QSIMPLEQ_HEAD(guest_apdu_list, EmulEvent) guest_apdu_list; + QSIMPLEQ_HEAD(, EmulEvent) guest_apdu_list; QemuMutex vreader_mutex; /* and guest_apdu_list mutex */ QemuMutex handle_apdu_mutex; QemuCond handle_apdu_cond; diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c index 385e090..ffab3fa 100644 --- a/hw/usb/dev-network.c +++ b/hw/usb/dev-network.c @@ -648,7 +648,7 @@ typedef struct USBNetState { char usbstring_mac[13]; NICState *nic; NICConf conf; - QTAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp; + QTAILQ_HEAD(, rndis_response) rndis_resp; } USBNetState; #define TYPE_USB_NET "usb-net" diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c index 5b2e21e..5564eb9 100644 --- a/hw/usb/xen-usb.c +++ b/hw/usb/xen-usb.c @@ -72,7 +72,7 @@ struct usbback_stub { USBPort port; unsigned int speed; bool attached; - QTAILQ_HEAD(submit_q_head, usbback_req) submit_q; + QTAILQ_HEAD(, usbback_req) submit_q; }; struct usbback_req { @@ -108,8 +108,8 @@ struct usbback_info { int num_ports; int usb_ver; bool ring_error; - QTAILQ_HEAD(req_free_q_head, usbback_req) req_free_q; - QSIMPLEQ_HEAD(hotplug_q_head, usbback_hotplug) hotplug_q; + QTAILQ_HEAD(, usbback_req) req_free_q; + QSIMPLEQ_HEAD(, usbback_hotplug) hotplug_q; struct usbback_stub ports[USBBACK_MAXPORTS]; struct usbback_stub *addr_table[USB_DEV_ADDR_SIZE]; QEMUBH *bh; diff --git a/hw/watchdog/watchdog.c b/hw/watchdog/watchdog.c index 33e6c20..dce7c1d 100644 --- a/hw/watchdog/watchdog.c +++ b/hw/watchdog/watchdog.c @@ -32,7 +32,7 @@ #include "qemu/help_option.h" static WatchdogAction watchdog_action = WATCHDOG_ACTION_RESET; -static QLIST_HEAD(watchdog_list, WatchdogTimerModel) watchdog_list; +static QLIST_HEAD(, WatchdogTimerModel) watchdog_list; void watchdog_add_model(WatchdogTimerModel *model) { diff --git a/hw/xen/xen_pvdev.c b/hw/xen/xen_pvdev.c index aed783e..f026556 100644 --- a/hw/xen/xen_pvdev.c +++ b/hw/xen/xen_pvdev.c @@ -31,10 +31,10 @@ struct xs_dirs { QTAILQ_ENTRY(xs_dirs) list; }; -static QTAILQ_HEAD(xs_dirs_head, xs_dirs) xs_cleanup = +static QTAILQ_HEAD(, xs_dirs) xs_cleanup = QTAILQ_HEAD_INITIALIZER(xs_cleanup); -static QTAILQ_HEAD(XenDeviceHead, XenDevice) xendevs = +static QTAILQ_HEAD(, XenDevice) xendevs = QTAILQ_HEAD_INITIALIZER(xendevs); /* ------------------------------------------------------------- */ diff --git a/include/exec/memory.h b/include/exec/memory.h index 8e61450..ce93068 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -379,9 +379,9 @@ struct MemoryRegion { MemoryRegion *alias; hwaddr alias_offset; int32_t priority; - QTAILQ_HEAD(subregions, MemoryRegion) subregions; + QTAILQ_HEAD(, MemoryRegion) subregions; QTAILQ_ENTRY(MemoryRegion) subregions_link; - QTAILQ_HEAD(coalesced_ranges, CoalescedMemoryRange) coalesced; + QTAILQ_HEAD(, CoalescedMemoryRange) coalesced; const char *name; unsigned ioeventfd_nb; MemoryRegionIoeventfd *ioeventfds; diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h index 0ee10b1..30d3c28 100644 --- a/include/hw/vfio/vfio-platform.h +++ b/include/hw/vfio/vfio-platform.h @@ -53,7 +53,7 @@ typedef struct VFIOPlatformDevice { VFIORegion **regions; QLIST_HEAD(, VFIOINTp) intp_list; /* list of IRQs */ /* queue of pending IRQs */ - QSIMPLEQ_HEAD(pending_intp_queue, VFIOINTp) pending_intp_queue; + QSIMPLEQ_HEAD(, VFIOINTp) pending_intp_queue; char *compat; /* DT compatible values, separated by NUL */ unsigned int num_compat; /* number of compatible values */ uint32_t mmap_timeout; /* delay to re-enable mmaps after interrupt */ diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 1396f53..62aef77 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -375,9 +375,9 @@ struct CPUState { QTAILQ_ENTRY(CPUState) node; /* ice debug support */ - QTAILQ_HEAD(breakpoints_head, CPUBreakpoint) breakpoints; + QTAILQ_HEAD(, CPUBreakpoint) breakpoints; - QTAILQ_HEAD(watchpoints_head, CPUWatchpoint) watchpoints; + QTAILQ_HEAD(, CPUWatchpoint) watchpoints; CPUWatchpoint *watchpoint_hit; void *opaque; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 97d8d9d..a6d1cd1 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -412,8 +412,6 @@ struct kvm_sw_breakpoint { QTAILQ_ENTRY(kvm_sw_breakpoint) entry; }; -QTAILQ_HEAD(kvm_sw_breakpoint_head, kvm_sw_breakpoint); - struct kvm_sw_breakpoint *kvm_find_sw_breakpoint(CPUState *cpu, target_ulong pc); diff --git a/include/sysemu/rng.h b/include/sysemu/rng.h index 45629c4..27b37da 100644 --- a/include/sysemu/rng.h +++ b/include/sysemu/rng.h @@ -57,7 +57,7 @@ struct RngBackend /*< protected >*/ bool opened; - QSIMPLEQ_HEAD(requests, RngRequest) requests; + QSIMPLEQ_HEAD(, RngRequest) requests; }; diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 5bccd2e..4cff9e1 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -2844,7 +2844,7 @@ struct elf_note_info { struct target_elf_prstatus *prstatus; /* NT_PRSTATUS */ struct target_elf_prpsinfo *psinfo; /* NT_PRPSINFO */ - QTAILQ_HEAD(thread_list_head, elf_thread_status) thread_list; + QTAILQ_HEAD(, elf_thread_status) thread_list; #if 0 /* * Current version of ELF coredump doesn't support diff --git a/memory.c b/memory.c index 5759f74..195c5cf 100644 --- a/memory.c +++ b/memory.c @@ -2795,7 +2795,7 @@ struct MemoryRegionList { QTAILQ_ENTRY(MemoryRegionList) mrqueue; }; -typedef QTAILQ_HEAD(mrqueue, MemoryRegionList) MemoryRegionListHead; +typedef QTAILQ_HEAD(, MemoryRegionList) MemoryRegionListHead; #define MR_SIZE(size) (int128_nz(size) ? (hwaddr)int128_get64( \ int128_sub((size), int128_one())) : 0) diff --git a/migration/block-dirty-bitmap.c b/migration/block-dirty-bitmap.c index 5e90f44..6426151 100644 --- a/migration/block-dirty-bitmap.c +++ b/migration/block-dirty-bitmap.c @@ -116,7 +116,7 @@ typedef struct DirtyBitmapMigBitmapState { } DirtyBitmapMigBitmapState; typedef struct DirtyBitmapMigState { - QSIMPLEQ_HEAD(dbms_list, DirtyBitmapMigBitmapState) dbms_list; + QSIMPLEQ_HEAD(, DirtyBitmapMigBitmapState) dbms_list; bool bulk_completed; bool no_bitmaps; diff --git a/migration/block.c b/migration/block.c index 4c04d93..0e24e18 100644 --- a/migration/block.c +++ b/migration/block.c @@ -93,12 +93,12 @@ typedef struct BlkMigBlock { } BlkMigBlock; typedef struct BlkMigState { - QSIMPLEQ_HEAD(bmds_list, BlkMigDevState) bmds_list; + QSIMPLEQ_HEAD(, BlkMigDevState) bmds_list; int64_t total_sector_sum; bool zero_blocks; /* Protected by lock. */ - QSIMPLEQ_HEAD(blk_list, BlkMigBlock) blk_list; + QSIMPLEQ_HEAD(, BlkMigBlock) blk_list; int submitted; int read_done; diff --git a/migration/ram.c b/migration/ram.c index 7e7deec..1849979 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -322,7 +322,7 @@ struct RAMState { RAMBlock *last_req_rb; /* Queue of outstanding page requests from the destination */ QemuMutex src_page_req_mutex; - QSIMPLEQ_HEAD(src_page_requests, RAMSrcPageRequest) src_page_requests; + QSIMPLEQ_HEAD(, RAMSrcPageRequest) src_page_requests; }; typedef struct RAMState RAMState; diff --git a/monitor.c b/monitor.c index d39390c..b8bdb98 100644 --- a/monitor.c +++ b/monitor.c @@ -266,11 +266,11 @@ typedef struct QMPRequest QMPRequest; /* Protects mon_list, monitor_qapi_event_state. */ static QemuMutex monitor_lock; static GHashTable *monitor_qapi_event_state; -static QTAILQ_HEAD(mon_list, Monitor) mon_list; +static QTAILQ_HEAD(, Monitor) mon_list; /* Protects mon_fdsets */ static QemuMutex mon_fdsets_lock; -static QLIST_HEAD(mon_fdsets, MonFdset) mon_fdsets; +static QLIST_HEAD(, MonFdset) mon_fdsets; static int mon_refcount; diff --git a/net/queue.c b/net/queue.c index 9c32abd..61276ca 100644 --- a/net/queue.c +++ b/net/queue.c @@ -55,7 +55,7 @@ struct NetQueue { uint32_t nq_count; NetQueueDeliverFunc *deliver; - QTAILQ_HEAD(packets, NetPacket) packets; + QTAILQ_HEAD(, NetPacket) packets; unsigned delivering : 1; }; diff --git a/net/slirp.c b/net/slirp.c index f6dc039..38ae65e 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -85,7 +85,7 @@ typedef struct SlirpState { } SlirpState; static struct slirp_config_str *slirp_configs; -static QTAILQ_HEAD(slirp_stacks, SlirpState) slirp_stacks = +static QTAILQ_HEAD(, SlirpState) slirp_stacks = QTAILQ_HEAD_INITIALIZER(slirp_stacks); static int slirp_hostfwd(SlirpState *s, const char *redir_str, Error **errp); diff --git a/slirp/slirp.c b/slirp/slirp.c index 322edf5..ab2fc4e 100644 --- a/slirp/slirp.c +++ b/slirp/slirp.c @@ -47,7 +47,7 @@ static const uint8_t special_ethaddr[ETH_ALEN] = { u_int curtime; -static QTAILQ_HEAD(slirp_instances, Slirp) slirp_instances = +static QTAILQ_HEAD(, Slirp) slirp_instances = QTAILQ_HEAD_INITIALIZER(slirp_instances); static struct in_addr dns_addr; diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 44dd0ce..e00ccf9 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -206,7 +206,7 @@ typedef struct KVMDevice { int dev_fd; } KVMDevice; -static QSLIST_HEAD(kvm_devices_head, KVMDevice) kvm_devices_head; +static QSLIST_HEAD(, KVMDevice) kvm_devices_head; static void kvm_arm_devlistener_add(MemoryListener *listener, MemoryRegionSection *section) diff --git a/target/i386/hax-mem.c b/target/i386/hax-mem.c index 5c37e94..6bb5a24 100644 --- a/target/i386/hax-mem.c +++ b/target/i386/hax-mem.c @@ -56,7 +56,7 @@ typedef struct HAXMapping { * send to the kernel only the removal of the pages from the MMIO hole after * having computed locally the result of the deletion and additions. */ -static QTAILQ_HEAD(HAXMappingListHead, HAXMapping) mappings = +static QTAILQ_HEAD(, HAXMapping) mappings = QTAILQ_HEAD_INITIALIZER(mappings); /** diff --git a/tcg/tcg.h b/tcg/tcg.h index f4efbaa..1e9c87b 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -704,7 +704,7 @@ struct TCGContext { /* These structures are private to tcg-target.inc.c. */ #ifdef TCG_TARGET_NEED_LDST_LABELS - QSIMPLEQ_HEAD(ldst_labels, TCGLabelQemuLdst) ldst_labels; + QSIMPLEQ_HEAD(, TCGLabelQemuLdst) ldst_labels; #endif #ifdef TCG_TARGET_NEED_POOL_LABELS struct TCGLabelPoolData *pool_labels; diff --git a/tests/test-rcu-list.c b/tests/test-rcu-list.c index 2e6f70b..6f07647 100644 --- a/tests/test-rcu-list.c +++ b/tests/test-rcu-list.c @@ -108,7 +108,7 @@ static void reclaim_list_el(struct rcu_head *prcu) } #if TEST_LIST_TYPE == 1 -static QLIST_HEAD(q_list_head, list_element) Q_list_head; +static QLIST_HEAD(, list_element) Q_list_head; #define TEST_NAME "qlist" #define TEST_LIST_REMOVE_RCU QLIST_REMOVE_RCU diff --git a/vl.c b/vl.c index f6a6193..4431ae6 100644 --- a/vl.c +++ b/vl.c @@ -1529,7 +1529,7 @@ struct vm_change_state_entry { QLIST_ENTRY (vm_change_state_entry) entries; }; -static QLIST_HEAD(vm_change_state_head, vm_change_state_entry) vm_change_state_head; +static QLIST_HEAD(, vm_change_state_entry) vm_change_state_head; VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb, void *opaque) From patchwork Wed Dec 12 15:22:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726587 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 9D6CC14BD for ; Wed, 12 Dec 2018 15:42:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BC41285AF for ; Wed, 12 Dec 2018 15:42:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FC7329BE8; Wed, 12 Dec 2018 15:42:39 +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 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 DC94F285AF for ; Wed, 12 Dec 2018 15:42:38 +0000 (UTC) Received: from localhost ([::1]:45659 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ej-0008B5-Lq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:42:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mc-0000tb-AZ for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MY-0000H1-Ti for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:50376) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MY-0000Ea-A7 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:50 -0500 Received: by mail-wm1-x32b.google.com with SMTP id n190so6209731wmd.0 for ; Wed, 12 Dec 2018 07:23:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m+S9G74m3JSBEClKOiJM8gEL38X3fTn+quy9Nw7kZWA=; b=qRCdDvAgmqBp80tDq9nTY3cknh7Slw2GQmXGB68z9mtPzBi3rvpepXqCyusRCh2UYO zRKHBa47SNNISEZhM7KW+VWfgBV7uAwwod+VsIyp3i9oTX76lhdGIldcF3sThU0nvErZ 3wYnIgeupBd4iNF5V1GAgmM0Dwcpsb1rTdRbHEt3DXrFZbi6s31k5Gfzjtbt5iJ0wIxL Oq5kMt3GRf2hi/1koVtWxix2vSQ8PLW2jB3fL4pzxaQ8GDgqoy2v9XUNQCfRk6jd4ZQ0 S4vDvZkIAWV7P98EmfionysYyZEGN6eBZ0v3ps3dr4bZoQ3nbCHO7cG+z/DfXkwNd6fC WbdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=m+S9G74m3JSBEClKOiJM8gEL38X3fTn+quy9Nw7kZWA=; b=UDjeR4AykpwNYEEsT6o77YKwiQFwS7kIh+ZbC7jQOdXyGhskgMTSEcDb7pf1wg2UYB GenQs67hXaGRBoKXuzEkebAdttAsrEgGAIcKvJ+Nj4d4mkyysX53BMCPpjeugLWMMe57 vXcB3u0b4xfX132awAAibk0BzJMSKYs8ABsTSZ8eHAa941q8d1sOma6vTLhGWkIfAVF7 fe9p3H1NYWgxBtI/XzGp5pI5UU/mV3biriwvQrufeE+BQOd8TU0o6YKPxiHhgVtEbIFB NFgGt1tXQ3/sz4Q+6s1WzcICEoI3ybO9cg5hgIOVds3LGhXcHvuZLSl4LtjwAAVNaakz VL6w== X-Gm-Message-State: AA+aEWbr/dNCY9jcFNrPC4djpaIN3W7HKULnAjRHPW/yp9T3cLptB6dT 78JEmpBNWR8KLfYPE6/2+kp98P2p X-Google-Smtp-Source: AFSGD/Vd5kLoXEfpW/ORhXCSGDYtbzECOryAHm5V9cLstrc+mT0pfc863ainONjYZtTfUHsxxW6zAQ== X-Received: by 2002:a1c:2d42:: with SMTP id t63mr7042897wmt.9.1544628228595; Wed, 12 Dec 2018 07:23:48 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.47 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:47 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:49 +0100 Message-Id: <1544628195-37728-29-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [PULL 28/54] qemu/queue.h: typedef QTAILQ heads 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will be needed when we change the QTAILQ head and elem structs to unions. However, it is also consistent with the usage elsewhere in QEMU for other list head structs (see for example FsMountList). Note that most QTAILQs only need their name in order to do backwards walks. Those do not break with the struct->union change, and anyway the change will also remove the need to name heads when doing backwards walks, so those are not touched here. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster Signed-off-by: Paolo Bonzini --- exec.c | 3 ++- hw/vfio/common.c | 2 +- include/hw/vfio/vfio-common.h | 3 ++- include/qom/cpu.h | 5 +++-- ui/input.c | 14 ++++++++------ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/exec.c b/exec.c index b6b2007..a629c98 100644 --- a/exec.c +++ b/exec.c @@ -94,7 +94,8 @@ int target_page_bits; bool target_page_bits_decided; #endif -struct CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); +CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus); + /* current CPU in the current thread. It is only valid inside cpu_exec() */ __thread CPUState *current_cpu; diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 7aa804e..4262b80 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -37,7 +37,7 @@ #include "trace.h" #include "qapi/error.h" -struct vfio_group_head vfio_group_list = +VFIOGroupList vfio_group_list = QLIST_HEAD_INITIALIZER(vfio_group_list); static QLIST_HEAD(, VFIOAddressSpace) vfio_address_spaces = QLIST_HEAD_INITIALIZER(vfio_address_spaces); diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 127ca47..7624c9f 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -180,7 +180,8 @@ int vfio_get_device(VFIOGroup *group, const char *name, VFIODevice *vbasedev, Error **errp); extern const MemoryRegionOps vfio_region_ops; -extern QLIST_HEAD(vfio_group_head, VFIOGroup) vfio_group_list; +typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; +extern VFIOGroupList vfio_group_list; #ifdef CONFIG_LINUX int vfio_get_region_info(VFIODevice *vbasedev, int index, diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 62aef77..4662a20 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -435,8 +435,9 @@ struct CPUState { GArray *iommu_notifiers; }; -QTAILQ_HEAD(CPUTailQ, CPUState); -extern struct CPUTailQ cpus; +typedef QTAILQ_HEAD(CPUTailQ, CPUState) CPUTailQ; +extern CPUTailQ cpus; + #define first_cpu QTAILQ_FIRST_RCU(&cpus) #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus, node) diff --git a/ui/input.c b/ui/input.c index 7c9a410..35c7964 100644 --- a/ui/input.c +++ b/ui/input.c @@ -19,6 +19,9 @@ struct QemuInputHandlerState { }; typedef struct QemuInputEventQueue QemuInputEventQueue; +typedef QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) + QemuInputEventQueueHead; + struct QemuInputEventQueue { enum { QEMU_INPUT_QUEUE_DELAY = 1, @@ -37,8 +40,7 @@ static QTAILQ_HEAD(, QemuInputHandlerState) handlers = static NotifierList mouse_mode_notifiers = NOTIFIER_LIST_INITIALIZER(mouse_mode_notifiers); -static QTAILQ_HEAD(QemuInputEventQueueHead, QemuInputEventQueue) kbd_queue = - QTAILQ_HEAD_INITIALIZER(kbd_queue); +static QemuInputEventQueueHead kbd_queue = QTAILQ_HEAD_INITIALIZER(kbd_queue); static QEMUTimer *kbd_timer; static uint32_t kbd_default_delay_ms = 10; static uint32_t queue_count; @@ -257,7 +259,7 @@ static void qemu_input_event_trace(QemuConsole *src, InputEvent *evt) static void qemu_input_queue_process(void *opaque) { - struct QemuInputEventQueueHead *queue = opaque; + QemuInputEventQueueHead *queue = opaque; QemuInputEventQueue *item; g_assert(!QTAILQ_EMPTY(queue)); @@ -288,7 +290,7 @@ static void qemu_input_queue_process(void *opaque) } } -static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_delay(QemuInputEventQueueHead *queue, QEMUTimer *timer, uint32_t delay_ms) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); @@ -306,7 +308,7 @@ static void qemu_input_queue_delay(struct QemuInputEventQueueHead *queue, } } -static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, +static void qemu_input_queue_event(QemuInputEventQueueHead *queue, QemuConsole *src, InputEvent *evt) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); @@ -318,7 +320,7 @@ static void qemu_input_queue_event(struct QemuInputEventQueueHead *queue, queue_count++; } -static void qemu_input_queue_sync(struct QemuInputEventQueueHead *queue) +static void qemu_input_queue_sync(QemuInputEventQueueHead *queue) { QemuInputEventQueue *item = g_new0(QemuInputEventQueue, 1); From patchwork Wed Dec 12 15:22:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726591 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 4B10C15A6 for ; Wed, 12 Dec 2018 15:43:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3968E2465D for ; Wed, 12 Dec 2018 15:43:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2C4F82AA95; Wed, 12 Dec 2018 15:43:45 +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 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 C49E82465D for ; Wed, 12 Dec 2018 15:43:44 +0000 (UTC) Received: from localhost ([::1]:45658 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6fn-0007z6-WA for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:43:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mc-0000uK-OL for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6MZ-0000Ib-OV for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:54 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40847) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6MZ-0000Gj-EH for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:51 -0500 Received: by mail-wm1-x334.google.com with SMTP id q26so6345460wmf.5 for ; Wed, 12 Dec 2018 07:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=5cfkLTepo76y9FfWp+HiMhJbhnyEa8g2c7/EjtroLQc=; b=RbN05hynW+1bUHZmZbyhvFYv499YD2k5pEMmsoh0ETgAL+RDFgfhHUlExubQkGVnNL x2MMXcUjZIajB/s5Uej5UzkWw/7p8humvwfoQPdA87FvKiQSTJeuhPTp9q9lZ64+yDx4 ZuiDCAa9bVUEuzYpQHx5RDJbcR33znahvme1NZ7mg2CKIkHOdc0fLGMq/ovf0ZaDGMo8 859bgkMtQQC2AI7MoAY2QvNrlXVsFOyQVodIE0YNmTyT+OsvNLwvcRAmKw9mpRodLOYJ G/O7n0e+FPsT7i41pu6Jl1eXmDNRdw9icxxNkU67npHwcoBKDQY8dmIlS4MT8Wfwcz7z AVRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=5cfkLTepo76y9FfWp+HiMhJbhnyEa8g2c7/EjtroLQc=; b=JalWga164/aK8hoA5BOyF4MxogEec0hNTYMLCv22TdWSIkJQc7RK/X0UkLTjwJ5ksb /NvvbGvhJZ0BE0b7XZ+pSooCLqZHS0vPNeaKa38xzB9VeyiSFdcQjcuDvhG4Eq0pUehZ dE2eSXIh2HKcFxo7oNudEW0fSJShkJ8w3ELJnTk1D9SVfWKebVGywBufHXC1P2U8o0Q/ DaDMqPRKqv4zm3Hy87ZmsIECY0n+hY+itQACACsqNqkMUWuDVb+axrIk9Z0kLETiDyCN JEiTvL6lesWDZG03x4jTVhhddrEl0YZGwDkjeiBkI3pXwuZ2NOwo/t6Bl3VEqbKENHpq kZ8g== X-Gm-Message-State: AA+aEWZLlDVVtQpOgUpTT9uNY8g7p22iFhCQC8/k7C1cWSG8hjEZ9MoY uVgMd52/yzOwDiCwSkBcpl9blK+Y X-Google-Smtp-Source: AFSGD/V4BnrXtDDbaoSkLsHvWk+MfX8ykg1W7BLTVd+fPh6cjU7YYtcf1I0MzjTRMqdTolQSw814FA== X-Received: by 2002:a7b:c397:: with SMTP id s23mr4618767wmj.127.1544628229985; Wed, 12 Dec 2018 07:23:49 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:48 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:50 +0100 Message-Id: <1544628195-37728-30-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 29/54] qemu/queue.h: remove Q_TAILQ_{HEAD, ENTRY} 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These are not present for other kinds of queue, and unused. Zap them before more changes are made to the QTAILQ implementation. Signed-off-by: Paolo Bonzini --- include/qemu/queue.h | 14 ++++++-------- scripts/cocci-macro-file.h | 10 ---------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index ac418ef..b9571e9 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -350,22 +350,20 @@ struct { \ /* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ +#define QTAILQ_HEAD(name, type) \ struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ + type *tqh_first; /* first element */ \ + type **tqh_last; /* addr of last next element */ \ } -#define QTAILQ_HEAD(name, type) Q_TAILQ_HEAD(name, struct type,) #define QTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ +#define QTAILQ_ENTRY(type) \ struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ + type *tqe_next; /* next element */ \ + type **tqe_prev; /* address of previous next element */ \ } -#define QTAILQ_ENTRY(type) Q_TAILQ_ENTRY(struct type,) /* * Tail queue functions. diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index 9f2e72e..5c49369 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -93,11 +93,6 @@ struct { \ /* * Tail queue definitions. */ -#define Q_TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} #define QTAILQ_HEAD(name, type) \ struct name { \ type *tqh_first; /* first element */ \ @@ -107,11 +102,6 @@ struct name { \ #define QTAILQ_HEAD_INITIALIZER(head) \ { NULL, &(head).tqh_first } -#define Q_TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} #define QTAILQ_ENTRY(type) \ struct { \ type *tqe_next; /* next element */ \ From patchwork Wed Dec 12 15:22:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726609 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 B98DF1751 for ; Wed, 12 Dec 2018 15:46:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6CBE2B127 for ; Wed, 12 Dec 2018 15:46:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95FC52B19D; Wed, 12 Dec 2018 15:46:57 +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 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 4BE532B127 for ; Wed, 12 Dec 2018 15:46:56 +0000 (UTC) Received: from localhost ([::1]:45674 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6iq-0002H7-S3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:46:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52530) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zm-8k for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mb-0000K9-0v for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:38075) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Ma-0000Im-JI for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:52 -0500 Received: by mail-wm1-x344.google.com with SMTP id m22so6400441wml.3 for ; Wed, 12 Dec 2018 07:23:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=g3KPNe2kP2NEI6eLybjxxMRayw6otf40/66Uv29pH04=; b=ZsoZpBIIzyMdgnd2pWQj7wIRWjzyEyypnK64HH5TdFBvx9A3k3P0QMKvzyvTsG2MKI ouI+Xbx+G9Di8oVqslHB9cfHG1ZTCYetf6ZtoACBgmJPqzEGRik2VBcoGvjoZblH5EE1 vLVUkw1Z2V2+wjpa/ZIsHzIQALqIEESL4z8ddF6NDBwEwTIXLR+Y81DzkDcJMBmmUQRB XNZFcREGU0iUxnSVVcLhdJMVv4uOAxyZbUsuGHH+7zSF4Lg3/8lQuGhSNFLy2t7xWsqV /zdRO4O7rCBJWD5S80FJA2D7s2w8tSyev3gyfORrgY8w/n8XVx4VfzZvViMES14fy2H1 8VNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=g3KPNe2kP2NEI6eLybjxxMRayw6otf40/66Uv29pH04=; b=BCEAQ0uIacCs+/2HBbAj5tUfjaLzstG0knE2NmopE33AWswIqfA+v3rU6Qwz+VcdZh 9Obsn434EnBgSCDcs0Xwf447B7PdvTu5e1wfxNsfmemna9zc4jcgIeYG9q+AmTbcboJO 2TviFEkmFhYU+j+ew7awhYx/3/bw09fCaxYJO7N9Dmw/KeRMmIixjJBmUOvw3l1qxHAT b6vF1Z6dr70qjhuP+qGlUDmjPcGUrHhkHZa0f9/07ZvRyzMeGKqlLKdEq9jETcpCCJ5I GTqB0vIKzuNR8CUzbXa/yeA+fyKxZZza8OjvlhfsR729GxD5C3Ae9bzsDrE5heb0ksaL Ai0g== X-Gm-Message-State: AA+aEWb7tPrioFwL6wGP0QNqwgJqyu+V6Piwq/Qr9fAtTGtpq671NaI3 laq7id9AtqyMr5eYCuDzsEBFEHO3 X-Google-Smtp-Source: AFSGD/X6e1A9vLZsIGfB1SPpos30EOPG/jBYNRLaSo1a5EPD5yhzjp+ABSiApqmF3YAE4M6ts7xqcQ== X-Received: by 2002:a1c:58ce:: with SMTP id m197mr7076284wmb.31.1544628230944; Wed, 12 Dec 2018 07:23:50 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:50 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:51 +0100 Message-Id: <1544628195-37728-31-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PULL 30/54] qemu/queue.h: reimplement QTAILQ without pointer-to-pointers 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP QTAILQ is a doubly linked list, with a pointer-to-pointer to the last element from the head, and the previous element from each node. But if you squint enough, QTAILQ becomes a combination of a singly-linked forwards list, and another singly-linked list which goes backwards and is circular. This is the idea that lets QTAILQ implement reverse iteration: only, because the backwards list points inside the node, accessing the previous element needs to go two steps back and one forwards. What this patch does is implement it in these terms, without actually changing the in-memory layout at all. The coexistence of the two lists is realized by making QTAILQ_HEAD and QTAILQ_ENTRY unions of the forwards pointer and a generic QTailQLink node. Thq QTailQLink can walk the list in both directions; the union is needed so that the forwards pointer can have the correct type, as a sort of poor man's template. While there are other ways to get the same layout without a union, this one has the advantage of simpler operation in the debugger, because the fields tqh_first and tqe_next still exist as before the patch. Those fields are also used by scripts/qemugdb/mtree.py, so it's a good idea to preserve them. The advantage of the new representation is that the two-back-one-forward dance done by backwards accesses can be done all while operating on QTailQLinks. No casting to the head struct is needed anymore because, even though the QTailQLink's forward pointer is a void *, we can use typeof to recover the correct type. This patch only changes the implementation, not the interface. The next patch will remove the head struct name from the backwards visit macros. Signed-off-by: Paolo Bonzini --- include/qemu/queue.h | 139 ++++++++++++++++++++------------------------- include/qemu/rcu_queue.h | 45 ++++++++------- scripts/cocci-macro-file.h | 14 ++--- 3 files changed, 92 insertions(+), 106 deletions(-) diff --git a/include/qemu/queue.h b/include/qemu/queue.h index b9571e9..a893fac 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -346,23 +346,28 @@ struct { \ #define QSIMPLEQ_FIRST(head) ((head)->sqh_first) #define QSIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) +typedef struct QTailQLink { + void *tql_next; + struct QTailQLink *tql_prev; +} QTailQLink; /* - * Tail queue definitions. + * Tail queue definitions. The union acts as a poor man template, as if + * it were QTailQLink. */ #define QTAILQ_HEAD(name, type) \ -struct name { \ - type *tqh_first; /* first element */ \ - type **tqh_last; /* addr of last next element */ \ +union name { \ + struct type *tqh_first; /* first element */ \ + QTailQLink tqh_circ; /* link for circular backwards list */ \ } #define QTAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } } #define QTAILQ_ENTRY(type) \ -struct { \ - type *tqe_next; /* next element */ \ - type **tqe_prev; /* address of previous next element */ \ +union { \ + struct type *tqe_next; /* next element */ \ + QTailQLink tqe_circ; /* link for circular backwards list */ \ } /* @@ -370,51 +375,51 @@ struct { \ */ #define QTAILQ_INIT(head) do { \ (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ + (head)->tqh_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_HEAD(head, elm, field) do { \ if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_TAIL(head, elm, field) do { \ (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + (head)->tqh_circ.tql_prev->tql_next = (elm); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_BEFORE(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + (listelm)->field.tqe_circ.tql_prev->tql_next = (elm); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_REMOVE(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ - (elm)->field.tqe_prev = NULL; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_circ.tql_prev->tql_next = (elm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH(var, head, field) \ @@ -428,13 +433,13 @@ struct { \ (var) = (next_var)) #define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ + for ((var) = QTAILQ_LAST(head, headname); \ (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) + (var) = QTAILQ_PREV(var, headname, field)) #define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var) && ((prev_var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)), 1); \ + for ((var) = QTAILQ_LAST(head, headname); \ + (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ (var) = (prev_var)) /* @@ -443,71 +448,49 @@ struct { \ #define QTAILQ_EMPTY(head) ((head)->tqh_first == NULL) #define QTAILQ_FIRST(head) ((head)->tqh_first) #define QTAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_prev != NULL) +#define QTAILQ_IN_USE(elm, field) ((elm)->field.tqe_circ.tql_prev != NULL) +#define QTAILQ_LINK_PREV(link) \ + ((link).tql_prev->tql_prev->tql_next) #define QTAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) + ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) #define QTAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) + ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ)) #define field_at_offset(base, offset, type) \ - ((type) (((char *) (base)) + (offset))) - -typedef struct DUMMY_Q_ENTRY DUMMY_Q_ENTRY; -typedef struct DUMMY_Q DUMMY_Q; - -struct DUMMY_Q_ENTRY { - QTAILQ_ENTRY(DUMMY_Q_ENTRY) next; -}; - -struct DUMMY_Q { - QTAILQ_HEAD(DUMMY_Q_HEAD, DUMMY_Q_ENTRY) head; -}; - -#define dummy_q ((DUMMY_Q *) 0) -#define dummy_qe ((DUMMY_Q_ENTRY *) 0) + ((type *) (((char *) (base)) + (offset))) /* - * Offsets of layout of a tail queue head. - */ -#define QTAILQ_FIRST_OFFSET (offsetof(typeof(dummy_q->head), tqh_first)) -#define QTAILQ_LAST_OFFSET (offsetof(typeof(dummy_q->head), tqh_last)) -/* - * Raw access of elements of a tail queue + * Raw access of elements of a tail queue head. Offsets are all zero + * because it's a union. */ #define QTAILQ_RAW_FIRST(head) \ - (*field_at_offset(head, QTAILQ_FIRST_OFFSET, void **)) -#define QTAILQ_RAW_TQH_LAST(head) \ - (*field_at_offset(head, QTAILQ_LAST_OFFSET, void ***)) - -/* - * Offsets of layout of a tail queue element. - */ -#define QTAILQ_NEXT_OFFSET (offsetof(typeof(dummy_qe->next), tqe_next)) -#define QTAILQ_PREV_OFFSET (offsetof(typeof(dummy_qe->next), tqe_prev)) + field_at_offset(head, 0, void *) +#define QTAILQ_RAW_TQH_CIRC(head) \ + field_at_offset(head, 0, QTailQLink) /* * Raw access of elements of a tail entry */ #define QTAILQ_RAW_NEXT(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_NEXT_OFFSET, void **)) -#define QTAILQ_RAW_TQE_PREV(elm, entry) \ - (*field_at_offset(elm, entry + QTAILQ_PREV_OFFSET, void ***)) + field_at_offset(elm, entry, void *) +#define QTAILQ_RAW_TQE_CIRC(elm, entry) \ + field_at_offset(elm, entry, QTailQLink) /* - * Tail queue tranversal using pointer arithmetic. + * Tail queue traversal using pointer arithmetic. */ #define QTAILQ_RAW_FOREACH(elm, head, entry) \ - for ((elm) = QTAILQ_RAW_FIRST(head); \ + for ((elm) = *QTAILQ_RAW_FIRST(head); \ (elm); \ - (elm) = QTAILQ_RAW_NEXT(elm, entry)) + (elm) = *QTAILQ_RAW_NEXT(elm, entry)) /* * Tail queue insertion using pointer arithmetic. */ -#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ - QTAILQ_RAW_NEXT(elm, entry) = NULL; \ - QTAILQ_RAW_TQE_PREV(elm, entry) = QTAILQ_RAW_TQH_LAST(head); \ - *QTAILQ_RAW_TQH_LAST(head) = (elm); \ - QTAILQ_RAW_TQH_LAST(head) = &QTAILQ_RAW_NEXT(elm, entry); \ +#define QTAILQ_RAW_INSERT_TAIL(head, elm, entry) do { \ + *QTAILQ_RAW_NEXT(elm, entry) = NULL; \ + QTAILQ_RAW_TQE_CIRC(elm, entry)->tql_prev = QTAILQ_RAW_TQH_CIRC(head)->tql_prev; \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev->tql_next = (elm); \ + QTAILQ_RAW_TQH_CIRC(head)->tql_prev = QTAILQ_RAW_TQE_CIRC(elm, entry); \ } while (/*CONSTCOND*/0) #endif /* QEMU_SYS_QUEUE_H */ diff --git a/include/qemu/rcu_queue.h b/include/qemu/rcu_queue.h index 904b337..2d386f3 100644 --- a/include/qemu/rcu_queue.h +++ b/include/qemu/rcu_queue.h @@ -206,47 +206,50 @@ extern "C" { #define QTAILQ_INSERT_HEAD_RCU(head, elm, field) do { \ (elm)->field.tqe_next = (head)->tqh_first; \ if ((elm)->field.tqe_next != NULL) { \ - (head)->tqh_first->field.tqe_prev = &(elm)->field.tqe_next; \ + (head)->tqh_first->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(head)->tqh_first, (elm)); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ + (elm)->field.tqe_circ.tql_prev = &(head)->tqh_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - atomic_rcu_set((head)->tqh_last, (elm)); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ +#define QTAILQ_INSERT_TAIL_RCU(head, elm, field) do { \ + (elm)->field.tqe_next = NULL; \ + (elm)->field.tqe_circ.tql_prev = (head)->tqh_circ.tql_prev; \ + atomic_rcu_set(&(head)->tqh_circ.tql_prev->tql_next, (elm)); \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) #define QTAILQ_INSERT_AFTER_RCU(head, listelm, elm, field) do { \ (elm)->field.tqe_next = (listelm)->field.tqe_next; \ if ((elm)->field.tqe_next != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = &(elm)->field.tqe_next; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + &(elm)->field.tqe_circ; \ } else { \ - (head)->tqh_last = &(elm)->field.tqe_next; \ + (head)->tqh_circ.tql_prev = &(elm)->field.tqe_circ; \ } \ atomic_rcu_set(&(listelm)->field.tqe_next, (elm)); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ + (elm)->field.tqe_circ.tql_prev = &(listelm)->field.tqe_circ; \ } while (/*CONSTCOND*/0) -#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - atomic_rcu_set((listelm)->field.tqe_prev, (elm)); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ - } while (/*CONSTCOND*/0) +#define QTAILQ_INSERT_BEFORE_RCU(listelm, elm, field) do { \ + (elm)->field.tqe_circ.tql_prev = (listelm)->field.tqe_circ.tql_prev; \ + (elm)->field.tqe_next = (listelm); \ + atomic_rcu_set(&(listelm)->field.tqe_circ.tql_prev->tql_next, (elm)); \ + (listelm)->field.tqe_circ.tql_prev = &(elm)->field.tqe_circ; \ +} while (/*CONSTCOND*/0) #define QTAILQ_REMOVE_RCU(head, elm, field) do { \ if (((elm)->field.tqe_next) != NULL) { \ - (elm)->field.tqe_next->field.tqe_prev = (elm)->field.tqe_prev; \ + (elm)->field.tqe_next->field.tqe_circ.tql_prev = \ + (elm)->field.tqe_circ.tql_prev; \ } else { \ - (head)->tqh_last = (elm)->field.tqe_prev; \ + (head)->tqh_circ.tql_prev = (elm)->field.tqe_circ.tql_prev; \ } \ - atomic_set((elm)->field.tqe_prev, (elm)->field.tqe_next); \ - (elm)->field.tqe_prev = NULL; \ + atomic_set(&(elm)->field.tqe_circ.tql_prev->tql_next, (elm)->field.tqe_next); \ + (elm)->field.tqe_circ.tql_prev = NULL; \ } while (/*CONSTCOND*/0) #define QTAILQ_FOREACH_RCU(var, head, field) \ diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index 5c49369..1cb0b4a 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -94,18 +94,18 @@ struct { \ * Tail queue definitions. */ #define QTAILQ_HEAD(name, type) \ -struct name { \ - type *tqh_first; /* first element */ \ - type **tqh_last; /* addr of last next element */ \ +union name { \ + struct type *tqh_first; /* first element */ \ + QTailQLink tqh_circ; /* link for last element */ \ } #define QTAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } + { .tqh_circ = { NULL, &(head).tqh_circ } } #define QTAILQ_ENTRY(type) \ -struct { \ - type *tqe_next; /* next element */ \ - type **tqe_prev; /* address of previous next element */ \ +union { \ + struct type *tqe_next; /* next element */ \ + QTailQLink tqe_circ; /* link for prev element */ \ } /* From glib */ From patchwork Wed Dec 12 15:22:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726645 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 B79D6174F for ; Wed, 12 Dec 2018 15:59:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A552E29FF7 for ; Wed, 12 Dec 2018 15:59:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97B3B2A053; Wed, 12 Dec 2018 15:59:02 +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 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 52AAE29FF7 for ; Wed, 12 Dec 2018 15:59:01 +0000 (UTC) Received: from localhost ([::1]:45742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ua-0005RZ-GN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:59:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52527) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zi-7l for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mb-0000M4-Tw for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:39169) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mb-0000Jk-Co for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: by mail-wm1-x334.google.com with SMTP id f81so6347102wmd.4 for ; Wed, 12 Dec 2018 07:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=RNKHQMUNd8B7gCD0bbqFm3HKuUDt2QHxprMyUtmu/8s=; b=nYaP22JYizAUuCepK4kRsIHVsajrvv8fgdF0DET0EqITRJwDVLkDKdCeifeaJjW+L9 XpgdjNfC4bFB6l6/jkf8mv9N6O890qxyRLXJaFaOJZUSevuxQxDWXU3jJbkR4rx6PQZ+ OvJvBKsRUmpJps38Hbc/nlxxK+eAWydEdjLgLQKoHTt8mGqX4pPNKNr/vf+R2pF6CA9J FBPMwhk8q9vKUOsPSCxZZTGl+AKS3okZ7JvPSVDEycFIFWt+Pt7SdOG6Ol7wnCVaIVFL GRUEeHwyZVd5ZOmy1+3FLBa0zoWXJIZ9cY0xCjnQzLfY2ikMBsRfCL5JqSMnubUSIUdZ yaiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=RNKHQMUNd8B7gCD0bbqFm3HKuUDt2QHxprMyUtmu/8s=; b=r1uDw7qCMjb5XxM3einJUCxxORjkvzZxXy1f75xnKYmTtxO2aMLa7NO7yo7sYsoksc Dv1qkfrEcOTnis65KOxsAoCQ/+4Zo48J+jHu7CmE5HclDtOa/rc1t5PQ4wHdGLhXu/3+ idG/y3CrOigyIj2pV9rEaL5nYnCew1wCHHIPS9YDokbXXdK3sasTxz3/vYXs3gxXoxSx 3MmK8wk0RFev8I+MT0Xq/lDbk7NRu7vmLmapaqqYLw0/fieRJF2p0sGOz9NpfpvdKGI0 LIDvSODvJDuxnDegy1lKUk07h+8CGCFoNxXPznujs8jf576oAHQzyDe0hGp5S13OXtoN 8Bag== X-Gm-Message-State: AA+aEWZTTPVp1G8yMJRAyrZETnjcUnEg6A8GJoabHgLXYE2QPUuOQx7A tOzzycL6MiBvH/jHQBwwEyEARSNb X-Google-Smtp-Source: AFSGD/XhXugVboRyoCa3VqCFowLwLMdGP1+8XeVo7DpxWPrFyiB00Zt24kwcamnkr1sTyeNE8Ywr2g== X-Received: by 2002:a1c:96ce:: with SMTP id y197mr7031083wmd.36.1544628231701; Wed, 12 Dec 2018 07:23:51 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.50 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:51 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:52 +0100 Message-Id: <1544628195-37728-32-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 31/54] qemu/queue.h: simplify reverse access to QTAILQ 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The new definition of QTAILQ does not require passing the headname, remove it. Signed-off-by: Paolo Bonzini --- cpus-common.c | 2 +- dump.c | 2 +- hw/core/qdev.c | 4 ++-- hw/scsi/scsi-bus.c | 2 +- hw/usb/combined-packet.c | 2 +- hw/usb/dev-mtp.c | 4 ++-- hw/usb/hcd-ehci.c | 2 +- hw/usb/hcd-ehci.h | 2 +- hw/usb/hcd-uhci.c | 4 ++-- include/exec/memory.h | 2 +- include/hw/qdev-core.h | 2 +- include/hw/usb.h | 2 +- include/net/net.h | 2 +- include/qemu/option_int.h | 2 +- include/qemu/queue.h | 16 ++++++++-------- include/sysemu/memory_mapping.h | 2 +- memory.c | 17 ++++++----------- memory_mapping.c | 2 +- net/filter.c | 2 +- net/net.c | 2 +- qga/commands-posix.c | 2 +- tcg/tcg.c | 2 +- tcg/tcg.h | 4 ++-- tests/libqos/malloc.c | 2 +- tests/test-vmstate.c | 8 ++++---- ui/console.c | 4 ++-- util/qemu-option.c | 4 ++-- 27 files changed, 48 insertions(+), 53 deletions(-) diff --git a/cpus-common.c b/cpus-common.c index 98dd8c6..3ca58c6 100644 --- a/cpus-common.c +++ b/cpus-common.c @@ -99,7 +99,7 @@ void cpu_list_remove(CPUState *cpu) return; } - assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus, CPUTailQ))); + assert(!(cpu_index_auto_assigned && cpu != QTAILQ_LAST(&cpus))); QTAILQ_REMOVE_RCU(&cpus, cpu, node); cpu->cpu_index = UNASSIGNED_CPU_INDEX; diff --git a/dump.c b/dump.c index 4ec94c5..ef1d802 100644 --- a/dump.c +++ b/dump.c @@ -1557,7 +1557,7 @@ static void get_max_mapnr(DumpState *s) { GuestPhysBlock *last_block; - last_block = QTAILQ_LAST(&s->guest_phys_blocks.head, GuestPhysBlockHead); + last_block = QTAILQ_LAST(&s->guest_phys_blocks.head); s->max_mapnr = dump_paddr_to_pfn(s, last_block->target_end); } diff --git a/hw/core/qdev.c b/hw/core/qdev.c index 6b3cc55..a7dd4be 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -158,7 +158,7 @@ DeviceState *qdev_try_create(BusState *bus, const char *type) return dev; } -static QTAILQ_HEAD(device_listeners, DeviceListener) device_listeners +static QTAILQ_HEAD(, DeviceListener) device_listeners = QTAILQ_HEAD_INITIALIZER(device_listeners); enum ListenerDirection { Forward, Reverse }; @@ -177,7 +177,7 @@ enum ListenerDirection { Forward, Reverse }; break; \ case Reverse: \ QTAILQ_FOREACH_REVERSE(_listener, &device_listeners, \ - device_listeners, link) { \ + link) { \ if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \ diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c index 97cd167..c480553 100644 --- a/hw/scsi/scsi-bus.c +++ b/hw/scsi/scsi-bus.c @@ -1554,7 +1554,7 @@ SCSIDevice *scsi_device_find(SCSIBus *bus, int channel, int id, int lun) BusChild *kid; SCSIDevice *target_dev = NULL; - QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, ChildrenHead, sibling) { + QTAILQ_FOREACH_REVERSE(kid, &bus->qbus.children, sibling) { DeviceState *qdev = kid->child; SCSIDevice *dev = SCSI_DEVICE(qdev); diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c index 01a7ed0..fc98383 100644 --- a/hw/usb/combined-packet.c +++ b/hw/usb/combined-packet.c @@ -64,7 +64,7 @@ void usb_combined_input_packet_complete(USBDevice *dev, USBPacket *p) status = combined->first->status; actual_length = combined->first->actual_length; - short_not_ok = QTAILQ_LAST(&combined->packets, packets_head)->short_not_ok; + short_not_ok = QTAILQ_LAST(&combined->packets)->short_not_ok; QTAILQ_FOREACH_SAFE(p, &combined->packets, combined_entry, next) { if (!done) { diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 100b717..c33d7d6 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -191,7 +191,7 @@ struct MTPState { #ifdef CONFIG_INOTIFY1 /* inotify descriptor */ int inotifyfd; - QTAILQ_HEAD(events, MTPMonEntry) events; + QTAILQ_HEAD(, MTPMonEntry) events; #endif /* Responder is expecting a write operation */ bool write_pending; @@ -1982,7 +1982,7 @@ static void usb_mtp_handle_data(USBDevice *dev, USBPacket *p) case EP_EVENT: #ifdef CONFIG_INOTIFY1 if (!QTAILQ_EMPTY(&s->events)) { - struct MTPMonEntry *e = QTAILQ_LAST(&s->events, events); + struct MTPMonEntry *e = QTAILQ_LAST(&s->events); uint32_t handle; int len = sizeof(container) + sizeof(uint32_t); diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c index e5acfc5..a2105c8 100644 --- a/hw/usb/hcd-ehci.c +++ b/hw/usb/hcd-ehci.c @@ -1815,7 +1815,7 @@ static int ehci_state_fetchqtd(EHCIQueue *q) break; case EHCI_ASYNC_INFLIGHT: /* Check if the guest has added new tds to the queue */ - again = ehci_fill_queue(QTAILQ_LAST(&q->packets, pkts_head)); + again = ehci_fill_queue(QTAILQ_LAST(&q->packets)); /* Unfinished async handled packet, go horizontal */ ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); break; diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h index 0bc364b..e4460aa 100644 --- a/hw/usb/hcd-ehci.h +++ b/hw/usb/hcd-ehci.h @@ -247,7 +247,7 @@ struct EHCIQueue { uint32_t qtdaddr; /* address QTD read from */ int last_pid; /* pid of last packet executed */ USBDevice *dev; - QTAILQ_HEAD(pkts_head, EHCIPacket) packets; + QTAILQ_HEAD(, EHCIPacket) packets; }; typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead; diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c index 836b11f..26f123e 100644 --- a/hw/usb/hcd-uhci.c +++ b/hw/usb/hcd-uhci.c @@ -99,7 +99,7 @@ struct UHCIQueue { UHCIState *uhci; USBEndpoint *ep; QTAILQ_ENTRY(UHCIQueue) next; - QTAILQ_HEAD(asyncs_head, UHCIAsync) asyncs; + QTAILQ_HEAD(, UHCIAsync) asyncs; int8_t valid; }; @@ -837,7 +837,7 @@ static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, } if (!async->done) { UHCI_TD last_td; - UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs, asyncs_head); + UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs); /* * While we are waiting for the current td to complete, the guest * may have added more tds to the queue. Note we re-read the td diff --git a/include/exec/memory.h b/include/exec/memory.h index ce93068..7353fa2 100644 --- a/include/exec/memory.h +++ b/include/exec/memory.h @@ -445,7 +445,7 @@ struct AddressSpace { int ioeventfd_nb; struct MemoryRegionIoeventfd *ioeventfds; - QTAILQ_HEAD(memory_listeners_as, MemoryListener) listeners; + QTAILQ_HEAD(, MemoryListener) listeners; QTAILQ_ENTRY(AddressSpace) address_spaces_link; }; diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index a24d0dd..43f926f 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -206,7 +206,7 @@ struct BusState { HotplugHandler *hotplug_handler; int max_index; bool realized; - QTAILQ_HEAD(ChildrenHead, BusChild) children; + QTAILQ_HEAD(, BusChild) children; QLIST_ENTRY(BusState) sibling; }; diff --git a/include/hw/usb.h b/include/hw/usb.h index a5080ad..f9431a0 100644 --- a/include/hw/usb.h +++ b/include/hw/usb.h @@ -408,7 +408,7 @@ struct USBPacket { struct USBCombinedPacket { USBPacket *first; - QTAILQ_HEAD(packets_head, USBPacket) packets; + QTAILQ_HEAD(, USBPacket) packets; QEMUIOVector iov; }; diff --git a/include/net/net.h b/include/net/net.h index ec13702..643295d 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -97,7 +97,7 @@ struct NetClientState { unsigned rxfilter_notify_enabled:1; int vring_enable; int vnet_hdr_len; - QTAILQ_HEAD(NetFilterHead, NetFilterState) filters; + QTAILQ_HEAD(, NetFilterState) filters; }; typedef struct NICState { diff --git a/include/qemu/option_int.h b/include/qemu/option_int.h index 26b1d9e..5dd9a51 100644 --- a/include/qemu/option_int.h +++ b/include/qemu/option_int.h @@ -47,7 +47,7 @@ struct QemuOpts { char *id; QemuOptsList *list; Location loc; - QTAILQ_HEAD(QemuOptHead, QemuOpt) head; + QTAILQ_HEAD(, QemuOpt) head; QTAILQ_ENTRY(QemuOpts) next; }; diff --git a/include/qemu/queue.h b/include/qemu/queue.h index a893fac..1f8e219 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -432,14 +432,14 @@ union { \ (var) && ((next_var) = ((var)->field.tqe_next), 1); \ (var) = (next_var)) -#define QTAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = QTAILQ_LAST(head, headname); \ +#define QTAILQ_FOREACH_REVERSE(var, head, field) \ + for ((var) = QTAILQ_LAST(head); \ (var); \ - (var) = QTAILQ_PREV(var, headname, field)) + (var) = QTAILQ_PREV(var, field)) -#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, prev_var) \ - for ((var) = QTAILQ_LAST(head, headname); \ - (var) && ((prev_var) = QTAILQ_PREV(var, headname, field)); \ +#define QTAILQ_FOREACH_REVERSE_SAFE(var, head, field, prev_var) \ + for ((var) = QTAILQ_LAST(head); \ + (var) && ((prev_var) = QTAILQ_PREV(var, field)); \ (var) = (prev_var)) /* @@ -452,9 +452,9 @@ union { \ #define QTAILQ_LINK_PREV(link) \ ((link).tql_prev->tql_prev->tql_next) -#define QTAILQ_LAST(head, headname) \ +#define QTAILQ_LAST(head) \ ((typeof((head)->tqh_first)) QTAILQ_LINK_PREV((head)->tqh_circ)) -#define QTAILQ_PREV(elm, headname, field) \ +#define QTAILQ_PREV(elm, field) \ ((typeof((elm)->field.tqe_next)) QTAILQ_LINK_PREV((elm)->field.tqe_circ)) #define field_at_offset(base, offset, type) \ diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 706152d..5845245 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -36,7 +36,7 @@ typedef struct GuestPhysBlock { /* point-in-time snapshot of guest-visible physical mappings */ typedef struct GuestPhysBlockList { unsigned num; - QTAILQ_HEAD(GuestPhysBlockHead, GuestPhysBlock) head; + QTAILQ_HEAD(, GuestPhysBlock) head; } GuestPhysBlockList; /* The physical and virtual address in the memory mapping are contiguous. */ diff --git a/memory.c b/memory.c index 195c5cf..61d66e4 100644 --- a/memory.c +++ b/memory.c @@ -39,7 +39,7 @@ static bool memory_region_update_pending; static bool ioeventfd_update_pending; static bool global_dirty_log = false; -static QTAILQ_HEAD(memory_listeners, MemoryListener) memory_listeners +static QTAILQ_HEAD(, MemoryListener) memory_listeners = QTAILQ_HEAD_INITIALIZER(memory_listeners); static QTAILQ_HEAD(, AddressSpace) address_spaces @@ -113,8 +113,7 @@ enum ListenerDirection { Forward, Reverse }; } \ break; \ case Reverse: \ - QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, \ - memory_listeners, link) { \ + QTAILQ_FOREACH_REVERSE(_listener, &memory_listeners, link) { \ if (_listener->_callback) { \ _listener->_callback(_listener, ##_args); \ } \ @@ -128,19 +127,17 @@ enum ListenerDirection { Forward, Reverse }; #define MEMORY_LISTENER_CALL(_as, _callback, _direction, _section, _args...) \ do { \ MemoryListener *_listener; \ - struct memory_listeners_as *list = &(_as)->listeners; \ \ switch (_direction) { \ case Forward: \ - QTAILQ_FOREACH(_listener, list, link_as) { \ + QTAILQ_FOREACH(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \ } \ break; \ case Reverse: \ - QTAILQ_FOREACH_REVERSE(_listener, list, memory_listeners_as, \ - link_as) { \ + QTAILQ_FOREACH_REVERSE(_listener, &(_as)->listeners, link_as) { \ if (_listener->_callback) { \ _listener->_callback(_listener, _section, ##_args); \ } \ @@ -2691,8 +2688,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) listener->address_space = as; if (QTAILQ_EMPTY(&memory_listeners) - || listener->priority >= QTAILQ_LAST(&memory_listeners, - memory_listeners)->priority) { + || listener->priority >= QTAILQ_LAST(&memory_listeners)->priority) { QTAILQ_INSERT_TAIL(&memory_listeners, listener, link); } else { QTAILQ_FOREACH(other, &memory_listeners, link) { @@ -2704,8 +2700,7 @@ void memory_listener_register(MemoryListener *listener, AddressSpace *as) } if (QTAILQ_EMPTY(&as->listeners) - || listener->priority >= QTAILQ_LAST(&as->listeners, - memory_listeners)->priority) { + || listener->priority >= QTAILQ_LAST(&as->listeners)->priority) { QTAILQ_INSERT_TAIL(&as->listeners, listener, link_as); } else { QTAILQ_FOREACH(other, &as->listeners, link_as) { diff --git a/memory_mapping.c b/memory_mapping.c index 724dd0b..e3ec706 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -223,7 +223,7 @@ static void guest_phys_blocks_region_add(MemoryListener *listener, if (!QTAILQ_EMPTY(&g->list->head)) { hwaddr predecessor_size; - predecessor = QTAILQ_LAST(&g->list->head, GuestPhysBlockHead); + predecessor = QTAILQ_LAST(&g->list->head); predecessor_size = predecessor->target_end - predecessor->target_start; /* the memory API guarantees monotonically increasing traversal */ diff --git a/net/filter.c b/net/filter.c index c9f9e5f..28d1930 100644 --- a/net/filter.c +++ b/net/filter.c @@ -55,7 +55,7 @@ static NetFilterState *netfilter_next(NetFilterState *nf, next = QTAILQ_NEXT(nf, next); } else { /* reverse order */ - next = QTAILQ_PREV(nf, NetFilterHead, next); + next = QTAILQ_PREV(nf, next); } return next; diff --git a/net/net.c b/net/net.c index 1f7d626..3acbdcc 100644 --- a/net/net.c +++ b/net/net.c @@ -563,7 +563,7 @@ static ssize_t filter_receive_iov(NetClientState *nc, } } } else { - QTAILQ_FOREACH_REVERSE(nf, &nc->filters, NetFilterHead, next) { + QTAILQ_FOREACH_REVERSE(nf, &nc->filters, next) { ret = qemu_netfilter_receive(nf, direction, sender, flags, iov, iovcnt, sent_cb); if (ret) { diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 1877976..18a4724 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -1291,7 +1291,7 @@ int64_t qmp_guest_fsfreeze_freeze_list(bool has_mountpoints, /* cannot risk guest agent blocking itself on a write in this state */ ga_set_frozen(ga_state); - QTAILQ_FOREACH_REVERSE(mount, &mounts, FsMountList, next) { + QTAILQ_FOREACH_REVERSE(mount, &mounts, next) { /* To issue fsfreeze in the reverse order of mounts, check if the * mount is listed in the list here */ if (has_mountpoints) { diff --git a/tcg/tcg.c b/tcg/tcg.c index e85133e..2e09093 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -2269,7 +2269,7 @@ static void liveness_pass_1(TCGContext *s) tcg_la_func_end(s); - QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, TCGOpHead, link, op_prev) { + QTAILQ_FOREACH_REVERSE_SAFE(op, &s->ops, link, op_prev) { int i, nb_iargs, nb_oargs; TCGOpcode opc_new, opc_new2; bool have_opc_new2; diff --git a/tcg/tcg.h b/tcg/tcg.h index 1e9c87b..cbe4309 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -715,7 +715,7 @@ struct TCGContext { TCGTempSet free_temps[TCG_TYPE_COUNT * 2]; TCGTemp temps[TCG_MAX_TEMPS]; /* globals first, temps after */ - QTAILQ_HEAD(TCGOpHead, TCGOp) ops, free_ops; + QTAILQ_HEAD(, TCGOp) ops, free_ops; /* Tells which temporary holds a given register. It does not take into account fixed registers */ @@ -843,7 +843,7 @@ static inline void tcg_set_insn_start_param(TCGOp *op, int arg, target_ulong v) /* The last op that was emitted. */ static inline TCGOp *tcg_last_op(void) { - return QTAILQ_LAST(&tcg_ctx->ops, TCGOpHead); + return QTAILQ_LAST(&tcg_ctx->ops); } /* Test for whether to terminate the TB for using too many opcodes. */ diff --git a/tests/libqos/malloc.c b/tests/libqos/malloc.c index ac05874..f7bae47 100644 --- a/tests/libqos/malloc.c +++ b/tests/libqos/malloc.c @@ -104,7 +104,7 @@ static void mlist_coalesce(MemList *head, MemBlock *node) do { merge = 0; - left = QTAILQ_PREV(node, MemList, MLIST_ENTNAME); + left = QTAILQ_PREV(node, MLIST_ENTNAME); right = QTAILQ_NEXT(node, MLIST_ENTNAME); /* clowns to the left of me */ diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c index 37a7a93..0ab29a8 100644 --- a/tests/test-vmstate.c +++ b/tests/test-vmstate.c @@ -630,7 +630,7 @@ struct TestQtailqElement { typedef struct TestQtailq { int16_t i16; - QTAILQ_HEAD(TestQtailqHead, TestQtailqElement) q; + QTAILQ_HEAD(, TestQtailqElement) q; int32_t i32; } TestQtailq; @@ -735,9 +735,9 @@ static void test_load_q(void) g_assert_cmpint(eof, ==, QEMU_VM_EOF); TestQtailqElement *qele_from = QTAILQ_FIRST(&obj_q.q); - TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q, TestQtailqHead); + TestQtailqElement *qlast_from = QTAILQ_LAST(&obj_q.q); TestQtailqElement *qele_to = QTAILQ_FIRST(&tgt.q); - TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q, TestQtailqHead); + TestQtailqElement *qlast_to = QTAILQ_LAST(&tgt.q); while (1) { g_assert_cmpint(qele_to->b, ==, qele_from->b); @@ -755,7 +755,7 @@ static void test_load_q(void) /* clean up */ TestQtailqElement *qele; while (!QTAILQ_EMPTY(&tgt.q)) { - qele = QTAILQ_LAST(&tgt.q, TestQtailqHead); + qele = QTAILQ_LAST(&tgt.q); QTAILQ_REMOVE(&tgt.q, qele, next); free(qele); qele = NULL; diff --git a/ui/console.c b/ui/console.c index 3a285ba..5a904e6 100644 --- a/ui/console.c +++ b/ui/console.c @@ -182,7 +182,7 @@ struct DisplayState { static DisplayState *display_state; static QemuConsole *active_console; -static QTAILQ_HEAD(consoles_head, QemuConsole) consoles = +static QTAILQ_HEAD(, QemuConsole) consoles = QTAILQ_HEAD_INITIALIZER(consoles); static bool cursor_visible_phase; static QEMUTimer *cursor_timer; @@ -1303,7 +1303,7 @@ static QemuConsole *new_console(DisplayState *ds, console_type_t console_type, s->index = 0; QTAILQ_INSERT_TAIL(&consoles, s, next); } else if (console_type != GRAPHIC_CONSOLE || qdev_hotplug) { - QemuConsole *last = QTAILQ_LAST(&consoles, consoles_head); + QemuConsole *last = QTAILQ_LAST(&consoles); s->index = last->index + 1; QTAILQ_INSERT_TAIL(&consoles, s, next); } else { diff --git a/util/qemu-option.c b/util/qemu-option.c index de42e2a..ef60af7 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -280,7 +280,7 @@ QemuOpt *qemu_opt_find(QemuOpts *opts, const char *name) { QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) { if (strcmp(opt->name, name) != 0) continue; return opt; @@ -379,7 +379,7 @@ bool qemu_opt_has_help_opt(QemuOpts *opts) { QemuOpt *opt; - QTAILQ_FOREACH_REVERSE(opt, &opts->head, QemuOptHead, next) { + QTAILQ_FOREACH_REVERSE(opt, &opts->head, next) { if (is_help_option(opt->name)) { return true; } From patchwork Wed Dec 12 15:22:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726599 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 B015E174F for ; Wed, 12 Dec 2018 15:45:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A11ED2AAA1 for ; Wed, 12 Dec 2018 15:45:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 957CA2AC78; Wed, 12 Dec 2018 15:45:35 +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 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 34E4D2AAA1 for ; Wed, 12 Dec 2018 15:45:35 +0000 (UTC) Received: from localhost ([::1]:45678 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ha-0002XI-DE for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:45:34 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zT-5K for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mc-0000MK-4t for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:58 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:53232) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mb-0000KF-Q0 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:53 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m1so5558572wml.2 for ; Wed, 12 Dec 2018 07:23:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=aMMuU3/fl9YywPbugjmVSAgZ5BhbfQiCOVigCSoWUXQ=; b=Ju6aJV4v6ivAfp4EC/aZejLr+JwRoTIzsfGg9OGKiE55gG0+iWVHoZqxY393A/KRAK g5H4RGMbcT8sKCIX/nxYEjKu3mvYrjYMH6DJ8KgtE3b/l56+MIb29wBV0RMfZ0ZHt7BD a8SbdrrI6KaDjuLMfY0m8msG/05Ns4FAT4ZYQqAq34YuUlIcmHbAvsZLGxjS+CdI8QMV 4Sj3orFHpQqX19lQKpyQGh+t2sx7PfG5z26LsFT60lFHDq86s4BY+AHv8fJgEUWedTp6 9z271opHIBjFiU0nDX6IaZvTatjFgN8ON4h5YWMvjuWJqFT8TI+sVSo/VhlJFZoIRPBK +ObA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=aMMuU3/fl9YywPbugjmVSAgZ5BhbfQiCOVigCSoWUXQ=; b=ngSj2pnayd4qq/Lu7E2jv09x3Jip7FBP8LtWZ2a8TeuIfJ87y0WUB2QXrtFwcxWTXF NwqSUZqWhbZ6tu6n5NswPbNFa8WFFkMAJecvhQCm9B8InkKZuAcVrIhRO4VZM0X0v2Mb n6cucYTc9Ct752K7d6gHzUJvrQNvc+hkU0Z3ltCP9c6eFuoseaZGlKaxTAAvzwRwKCg2 fM8FzPg321inHay4KxynQgF9qaBEjoop6h32IC6kvdoYcJRIH8gfIWfexJrJdZvo90MR nkx1FFA/6bR8XLB8+412O1biGSGu44e9qXaYAn6ldX6mNpDGXkYphO4H4pizYPkP51u/ topQ== X-Gm-Message-State: AA+aEWb7hUaQSu2iyvJVMTcBtZevgDwUBrelkj59I9vwFpE7eZFoybZ3 GhjUFzSGiXmadPJbftcK6oCeOMXQ X-Google-Smtp-Source: AFSGD/X1jZNUHLocReh11BTmS2j8D9y8kVP8gkvJSPFlcNM2JrYyOHOPoM5s/GXrYHa+RzhEaKRMKw== X-Received: by 2002:a1c:c645:: with SMTP id w66mr7253452wmf.18.1544628232385; Wed, 12 Dec 2018 07:23:52 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:51 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:53 +0100 Message-Id: <1544628195-37728-33-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32c Subject: [Qemu-devel] [PULL 32/54] checkpatch: warn about qemu/queue.h head structs that are not typedef-ed 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP These are just like any other struct or union, so they should have CamelCase typedefs. Signed-off-by: Paolo Bonzini --- scripts/checkpatch.pl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index a8d6e44..b4b3495 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2263,6 +2263,11 @@ sub process { } } + if ($line =~ /^.\s*(Q(?:S?LIST|SIMPLEQ|TAILQ)_HEAD)\s*\(\s*[^,]/ && + $line !~ /^.typedef/) { + ERROR("named $1 should be typedefed separately\n" . $herecurr); + } + # Need a space before open parenthesis after if, while etc if ($line=~/\b(if|while|for|switch)\(/) { ERROR("space required before the open parenthesis '('\n" . $herecurr); From patchwork Wed Dec 12 15:22:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726611 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 4F3D014BD for ; Wed, 12 Dec 2018 15:48:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4367729B98 for ; Wed, 12 Dec 2018 15:48:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3509429BBA; Wed, 12 Dec 2018 15:48:49 +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 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 BBFEC29B98 for ; Wed, 12 Dec 2018 15:48:48 +0000 (UTC) Received: from localhost ([::1]:45693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ki-0004ya-15 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:48:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52535) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zq-8u for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Md-0000Nj-7V for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:54482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mc-0000MS-U0 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:55 -0500 Received: by mail-wm1-x344.google.com with SMTP id a62so6179678wmh.4 for ; Wed, 12 Dec 2018 07:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Omg7v2Y7KTWH1aoAgDtptQTe4lugbmUuGw0+DjC3zqQ=; b=PWd2prEacNP/B6zqLNrdlIQz62+n4wp3qiqpGiPgzqsUczM/BdEw0gAPuo46VAs5OY 6ts3PG1I2Eh+ciyBpju1zuciErzBhVULumv9gIN8jG99zwgavckaFlpeFLskYT5ZOOPD ob9Ljc4y2PVn5FNocINJo/qyP9ZXqBtH7i8ox3uOUDTq5WYd1vpv3TrjsseyfIjBwSLU YCHO/J8pCU2j5ZpjLY0KOPVE4kJ8P6/IuswhqDUlL3YClEmEGSkhyTvxUuxYwwnMnuRD cRtEflminFEwyos8emYWyWMwYBgsUvU4xR9nITLD9Vq60oiKKr5mxKNCGwx721jsEefd rfRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Omg7v2Y7KTWH1aoAgDtptQTe4lugbmUuGw0+DjC3zqQ=; b=Q9hauGgw1jRTIi+EUb7fhVveGs8Jh78iuNGknApfi6bsutXN5d5OqL1y/IW1cFzcdD 0lRfbEWGNpM5Gbqp4VVQDlqWHiBh+gnbpREhG8Qds3HjqBLxelXYwddTjOMpcAHFxgAs GlgeUwV1pnQ+Hf2EChpHOAqysuKdsuwrgAdVbmiw2RaktrYLcIDVYFTfBKMyoy0/y+Bx QXehnd96ZGhWe+iu16xtcaDUlnVGCpIQIV763VBV457q10KLQ0JSTQ8gkOekQbGq4xq5 rhH0TnPZOlUskYEyrrpxxmuzywReiOUXo8jyN5bBpi2BfC7+udFsJjQb9mM5lbX15z+I LrEQ== X-Gm-Message-State: AA+aEWYOOk+IGVtnnBDNNM3Izo87gyd+5NWYUFjASN2T9DnQ3Dr/UWxM Kn5N/PQm8SGbAKlwpHvZkLvZ2vrS X-Google-Smtp-Source: AFSGD/UeTibPLzhIet+BrpxuqfCAYbIOMp8yaxCFj6cdgHQBVt1gELZ63sHgq7q+0DY9blzy3iLjrQ== X-Received: by 2002:a7b:cc86:: with SMTP id p6mr712327wma.19.1544628233461; Wed, 12 Dec 2018 07:23:53 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:52 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:54 +0100 Message-Id: <1544628195-37728-34-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 Subject: [Qemu-devel] [PULL 33/54] configure: Add a test for the minimum compiler version 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth So far we only had implicit requirements for the minimum compiler version, e.g. we require at least GCC 4.1 for the support of atomics. However, such old compiler versions are not tested anymore by the developers, so they are not really supported anymore. Since we recently declared explicitly what platforms we intend to support, we can also get more explicit on the compiler version now. The supported distributions use the following version of GCC: RHEL-7: 4.8.5 Debian (Stretch): 6.3.0 Debian (Jessie): 4.8.4 OpenBSD (ports): 4.9.4 FreeBSD (ports): 8.2.0 OpenSUSE Leap 15: 7.3.1 Ubuntu (Xenial): 5.3.1 macOS (Homebrew): 8.2.0 So we can safely assume GCC 4.8 these days. For Clang, the situation is a little bit more ambiguous, since it is sometimes not available in the main distros but rather third party repositories. At least Debian Jessie uses version 3.5, and EPEL7 for RHEL7 uses 3.4, so let's use 3.4 as minimum Clang version now - we still can adjust this later if necessary. Unfortunately Apple uses different version numbers for the Clang that is included in their Xcode suite, so we need to check the version numbers for Xcode separately. Xcode 5.1 seems to be the first one that has been shipped with LLVM 3.4, so use this version as the minimum there. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <1543937577-28256-2-git-send-email-thuth@redhat.com> --- configure | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/configure b/configure index 8c292ef..51150b1 100755 --- a/configure +++ b/configure @@ -1837,6 +1837,31 @@ if test "$bogus_os" = "yes"; then error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')" fi +# Check whether the compiler matches our minimum requirements: +cat > $TMPC << EOF +#if defined(__clang_major__) && defined(__clang_minor__) +# ifdef __apple_build_version__ +# if __clang_major__ < 5 || (__clang_major__ == 5 && __clang_minor__ < 1) +# error You need at least XCode Clang v5.1 to compile QEMU +# endif +# else +# if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 4) +# error You need at least Clang v3.4 to compile QEMU +# endif +# endif +#elif defined(__GNUC__) && defined(__GNUC_MINOR__) +# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +# error You need at least GCC v4.8 to compile QEMU +# endif +#else +# error You either need GCC or Clang to compiler QEMU +#endif +int main (void) { return 0; } +EOF +if ! compile_prog "" "" ; then + error_exit "You need at least GCC v4.8 or Clang v3.4 (or XCode Clang v5.1)" +fi + gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" gcc_flags="-Wno-missing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" From patchwork Wed Dec 12 15:22:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726637 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 D469A6C5 for ; Wed, 12 Dec 2018 15:55:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C49122A054 for ; Wed, 12 Dec 2018 15:55:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B82952B26F; Wed, 12 Dec 2018 15:55:53 +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 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 6D34D2A054 for ; Wed, 12 Dec 2018 15:55:53 +0000 (UTC) Received: from localhost ([::1]:45720 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6rY-0001VM-JN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:55:52 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zj-7p for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Me-0000Om-Iy for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:55395) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Md-0000Nn-TP for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:56 -0500 Received: by mail-wm1-x332.google.com with SMTP id y139so6133868wmc.5 for ; Wed, 12 Dec 2018 07:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fUgZ7mB3RUvlI3nkrpotmi5TTVC6vMXiR6JHRFCkcLc=; b=DfQ38xKSuvyDJonZL5pWQLZNNM5dID8nys2pxJWsIP5NyrSjcQ6ZQPlq3kZ2TZ/orq zXWbAnN07XWjZeiSbxuP+h5XS62Z88jE7Vn+qQIvYVBDvZIQ1YIUj/fEG7js1VCxeBIb 9JqhgLL0qOTrQ2kGoCfbcnP6RhwPf73990/ZOM3GI+YHr1WYYqa732oghYcdLCFt8OM0 2N/iaysm9OcgAB9Zwp6Hiu9Ua1j5w/kORFtrbFG0R4CV/wL0cc7ELWo5KKs6EiDbo/9Z jejR/OGfJcOaLRh5I+euFlbz4xMrjEq/3T+z0P5NT/0VEOmlwfGI1ypJCf4eob5VO1UO UC9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=fUgZ7mB3RUvlI3nkrpotmi5TTVC6vMXiR6JHRFCkcLc=; b=Q9iHKHfVeCxjY0bMxzY4hm7nmRjRpeaFxLY00RVuHmEYCwEXpLn9QklwRrChARyoWY Q/vek1hBQ3eVpX3YoxwHh53h28RIB4eCb/6804iGArUVtWP4pBYLSuwngTt7m+tzsTHZ 5sNe2u1xU08VIjEY97kH+SfJTuhtd86F1E51jgS5BxRweBYuE5F6Bxy2u4sDkriPLvAS YJvvvudojDf9Q9ggHO3oWN1f7myOHLDkYzvqRVTXlwDz65npzSzSItHs2QXg581OQ3Dp +hDVJE4oRSPs+c0T4+4o4Bp8SJMAW/bCu1lsSKZad/08AcxQnkj3PgBBubRZZ47N/JWg sOtA== X-Gm-Message-State: AA+aEWb4DgpCZdIDYVPVj2pT1nIAPBOs7r6sRw2LZdiKsKdzuOLx/h3K 3p8GsO71w06A8LPhywGH5plqHp+g X-Google-Smtp-Source: AFSGD/XenrOOgT49ywxveO27iMp//0YtcqSEE93xwIexWee8X/r32ErVMPb86IhSfGIhO0peknpesg== X-Received: by 2002:a1c:a755:: with SMTP id q82mr7022556wme.6.1544628234541; Wed, 12 Dec 2018 07:23:54 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:53 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:55 +0100 Message-Id: <1544628195-37728-35-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::332 Subject: [Qemu-devel] [PULL 34/54] configure: Remove obsolete check for Clang < 3.2 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth Since we have got a check for Clang >= 3.4 now, we do not need to check for older Clang versions in the configure test for 128-bit ints anymore. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <1543937577-28256-3-git-send-email-thuth@redhat.com> --- configure | 5 ----- 1 file changed, 5 deletions(-) diff --git a/configure b/configure index 51150b1..3e401b7 100755 --- a/configure +++ b/configure @@ -5145,11 +5145,6 @@ fi int128=no cat > $TMPC << EOF -#if defined(__clang_major__) && defined(__clang_minor__) -# if ((__clang_major__ < 3) || (__clang_major__ == 3) && (__clang_minor__ < 2)) -# error __int128_t does not work in CLANG before 3.2 -# endif -#endif __int128_t a; __uint128_t b; int main (void) { From patchwork Wed Dec 12 15:22:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726595 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 99DE614BD for ; Wed, 12 Dec 2018 15:44:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A2E92AAA1 for ; Wed, 12 Dec 2018 15:44:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E4D62AB82; Wed, 12 Dec 2018 15:44:42 +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 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 1985F2AAA1 for ; Wed, 12 Dec 2018 15:44:42 +0000 (UTC) Received: from localhost ([::1]:45662 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6gj-0000QC-8P for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:44:41 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zp-8t for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mf-0000PQ-5v for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:39680) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Me-0000Oa-RQ for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:57 -0500 Received: by mail-wr1-x42b.google.com with SMTP id t27so18088015wra.6 for ; Wed, 12 Dec 2018 07:23:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZpZtbMIXQeSgbr1hHQ6fPpSh6Rxi0yZVjHpkTvTLbvc=; b=F1tD0vss4IC8RazcxZKERWtaR9HqN0q9Hl6ScMdQIlXsbdtX2pBM17kL9YrM0NmWLO VZ6XSDgI5+gB8+wvPbIw3Lnc9O064XpWhz/c4hmL4AhrhEe0350AkiJR0e+YH1kk7qhn EaB8W7q4iYughyVgCbNdSZ2ElVkWzWFvOlwmHYQTOZCx/svx18L1LQZnvY9i9K37mUpx CjaoNxImXxzkPrDQwntEUPt0JabJinCJ//WoYqotmqxE3LuPGfecB0pTjPgWj+oKc0HM Js3DI73ZJ0wP/cL4GFbLEfTxBulnNcDLJM+rBknk50/COWDNNCkvWLxDeG2xtDKh4zIQ aS5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ZpZtbMIXQeSgbr1hHQ6fPpSh6Rxi0yZVjHpkTvTLbvc=; b=oQfpydmd0tka6ldMPHFzlDKUS6Q85YUpXhL3FneLVm3Tnj3QthPLlW0DVwLZDRUT+w 2MGvDxZrgWvfhHLW0T69MYDynMAgOfEv+qXFt09UQ4SwEW+SBFuS0R85wrfwNZZ12C/F A8j/LtPTJNtdZYFDDTFVbfGDP2iWaGYcFOhn3Jr5slicn2M9HCaYaf2YEf94VUW+aAW4 58cPPcQiGSOY0vMzAxL6bi+F/FWj7Z2TsUAj5LY7xM+3OIg/KFoMLkdIT5DqyG/07LRl QHvWGLI7B4x4zIzxWdQ9i6/mAofklHinM0DXXKAu5XjJL8mBQiXvp1t+7vIiBsmXeEP1 h+mQ== X-Gm-Message-State: AA+aEWZ0OUU3bFImBwJZBOf4mOKOytbUuzB3DPt0JPniAw9IDOZIe/2N TnEf2zzstBcw25XhihtI6TSs9RWK X-Google-Smtp-Source: AFSGD/XhzMqQ7UppDw0DoLNEq18nPHVvfIEqSJhatzMk4FuUaWkmdbVVNvginf53im4Xj9QFfo9Psg== X-Received: by 2002:a5d:494a:: with SMTP id r10mr18335369wrs.272.1544628235498; Wed, 12 Dec 2018 07:23:55 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:54 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:56 +0100 Message-Id: <1544628195-37728-36-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42b Subject: [Qemu-devel] [PULL 35/54] configure: Remove old -fno-gcse workaround for GCC 4.6.x and 4.7.[012] 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth Now that we require at least GCC 4.8, we don't need this als workaround for 4.6 and 4.7 anymore. Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1543937577-28256-4-git-send-email-thuth@redhat.com> --- Makefile.target | 3 --- configure | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/Makefile.target b/Makefile.target index 4d56298..44ec4b6 100644 --- a/Makefile.target +++ b/Makefile.target @@ -158,9 +158,6 @@ GENERATED_FILES += hmp-commands.h hmp-commands-info.h endif # CONFIG_SOFTMMU -# Workaround for http://gcc.gnu.org/PR55489, see configure. -%/translate.o: QEMU_CFLAGS += $(TRANSLATE_OPT_CFLAGS) - dummy := $(call unnest-vars,,obj-y) all-obj-y := $(obj-y) diff --git a/configure b/configure index 3e401b7..131eae5 100755 --- a/configure +++ b/configure @@ -1933,21 +1933,6 @@ else QEMU_CFLAGS="$QEMU_CFLAGS -Wno-missing-braces" fi -# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and -# large functions that use global variables. The bug is in all releases of -# GCC, but it became particularly acute in 4.6.x and 4.7.x. It is fixed in -# 4.7.3 and 4.8.0. We should be able to delete this at the end of 2013. -cat > $TMPC << EOF -#if __GNUC__ == 4 && (__GNUC_MINOR__ == 6 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ <= 2)) -int main(void) { return 0; } -#else -#error No bug in this compiler. -#endif -EOF -if compile_prog "-Werror -fno-gcse" "" ; then - TRANSLATE_OPT_CFLAGS=-fno-gcse -fi - if test "$static" = "yes" ; then if test "$modules" = "yes" ; then error_exit "static and modules are mutually incompatible" @@ -6980,7 +6965,6 @@ echo "LIBS_QGA+=$libs_qga" >> $config_host_mak echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak echo "POD2MAN=$POD2MAN" >> $config_host_mak -echo "TRANSLATE_OPT_CFLAGS=$TRANSLATE_OPT_CFLAGS" >> $config_host_mak if test "$gcov" = "yes" ; then echo "CONFIG_GCOV=y" >> $config_host_mak echo "GCOV=$gcov_tool" >> $config_host_mak From patchwork Wed Dec 12 15:22:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726627 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 BA5FB14BD for ; Wed, 12 Dec 2018 15:52:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A90672B102 for ; Wed, 12 Dec 2018 15:52:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BEE12B261; Wed, 12 Dec 2018 15:52:57 +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 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 419102B102 for ; Wed, 12 Dec 2018 15:52:57 +0000 (UTC) Received: from localhost ([::1]:45712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6oi-0008U5-Cc for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:52:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mh-0000zk-8c for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mg-0000QG-2h for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:53269) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mf-0000PV-R1 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:57 -0500 Received: by mail-wm1-x335.google.com with SMTP id y1so6138256wmi.3 for ; Wed, 12 Dec 2018 07:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LI60ZqHN3sdmSISYXNeRkyBQ4KBQiPe1Wgfwop1y080=; b=pH2lmhqDyjEH3cjytyOx8Noo/pFRUiGvSoP+TC1tcTQ3lod8pOeQFreTB6hHX10+ii GnIcPgw2Jg7DNiNHyGN1YSGXqZVpUCl/2Hm0/j+FWOp9t+78qaFTVlGA7lu3moZ3yDHB sSoqINAECQ3XAVKOYLVi03968cPNNZGfMOw/6ona3upMZuxDmLuXZJXi6d3ZyEV2maNC LOEzuodXc3FxkftD64v3UNrg01wIWCyOBqJ7X5x11JuxeOCG9EPRAbe+5tGqcG2Xqvzg 7YNqz/TpwCqQnbY6jY99l+zZ5wdzsDyImn7mqIRlfPpubLxWHFKn3XF1v+XNb6WOv4bP ABvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LI60ZqHN3sdmSISYXNeRkyBQ4KBQiPe1Wgfwop1y080=; b=YekKvfXijxC/8o+Bnm9SIHcVcF8lKcwFYu06WZm5juPurU4ojoBd4ZkZZjGJ/bqbWv 57TVqKX7nLT5DgQXDsBNk9lk2ppp1CxlQGosG8JFrhDgcWk2imeuhW1hZLuuxAWQPPOn PSrJBH5ht9795b9qsmLImVQPHDFbUOsOjsjw3x2skx/Zr3WrmSd6GCwo1UMZdqQ+w/5n oV9UdxQkMfSuig6y6JzZ48fODziMffRGAG0/XliymuVU04ZpVhkFiNqnxykMm7osXyUN FfKZa5iEMsvOMAJYDYjIS9G2webA+W+7O33LWm5fYQKwUDp/J2m/eeH+s0/RRJ7Zd9Yw uPpQ== X-Gm-Message-State: AA+aEWb/eSz60UelUvPekNazFjjeCpxx1T2gJbZ6uY6Wv5tMm8xboJdx MqxbkcbVOz0i6OHbBFQ/tDiNdq6Z X-Google-Smtp-Source: AFSGD/X+Rn2znS0cvjfHVaq8+QaDB9oGaW4kXxfnfSOB1bCIFLlWw1i274EDS6U8RZVAbwR9Whimrg== X-Received: by 2002:a1c:cf82:: with SMTP id f124mr6921960wmg.95.1544628236494; Wed, 12 Dec 2018 07:23:56 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:55 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:57 +0100 Message-Id: <1544628195-37728-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 36/54] tcg/tcg.h: Remove GCC check for tcg_debug_assert() macro 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth Both GCC v4.8 and Clang v3.4 support (our minimum versions) support __builtin_unreachable(), so we can remove the version check here now. Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1543937577-28256-5-git-send-email-thuth@redhat.com> --- tcg/tcg.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index cbe4309..973a757 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -230,11 +230,9 @@ typedef uint64_t tcg_insn_unit; #if defined CONFIG_DEBUG_TCG || defined QEMU_STATIC_ANALYSIS # define tcg_debug_assert(X) do { assert(X); } while (0) -#elif QEMU_GNUC_PREREQ(4, 5) +#else # define tcg_debug_assert(X) \ do { if (!(X)) { __builtin_unreachable(); } } while (0) -#else -# define tcg_debug_assert(X) do { (void)(X); } while (0) #endif typedef struct TCGRelocation { From patchwork Wed Dec 12 15:22:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726629 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 33113174F for ; Wed, 12 Dec 2018 15:53:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E9A22B261 for ; Wed, 12 Dec 2018 15:53:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11E4C2B2C4; Wed, 12 Dec 2018 15:53:18 +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 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 B98212B261 for ; Wed, 12 Dec 2018 15:53:17 +0000 (UTC) Received: from localhost ([::1]:45709 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6p2-0007Vm-Tg for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:53:16 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52617) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mm-00016z-W7 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mh-0000SH-MJ for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:02 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:34997) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mh-0000Qt-Bx for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:23:59 -0500 Received: by mail-wm1-x336.google.com with SMTP id c126so6366926wmh.0 for ; Wed, 12 Dec 2018 07:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=XmI57uoRfIawUIGXDO601XYTb/eseIQH+yvn7mGUnjI=; b=I1a9kvQt4UkPTGrVqsFuDzmZzlCOiiCEZJEW88cYPrS61FAWK4nWd0CA3rzIv+tV+3 c+eJoeq0h+C+aF9ak7p1LNIb4HHUr/ZgYBJufZhyCMyUjI79lqGp0gqO9aCKMOZoFr8S SoA+P7d8VFp0xFSnYp+o4Dmfb31qiZ4YHBF8weVyGWc5MTo0BeakgvedtzM1e6rvapF7 oU1c0kwb7/01+4hlVloelbiPbL3oOghySqG3b696yKPk6aYgzDQkn/EPiLoHOV7JlxlL arOvDCJ1p8MofX54tDpYVfvMwGIbGnV4JM4GHPjIf5fzUOhU7Xq4k//RrMJtaFkdJW6q pmEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=XmI57uoRfIawUIGXDO601XYTb/eseIQH+yvn7mGUnjI=; b=iU0uKcOm6zOEIdQy6XuRihomK2geOAR+SQ6+qXJeP8kPV9EkN/Vv3YjryzQZMwNyUV 3FlMFdSFGfUXBLxHN9mZ4SJPgSwGKOOQ6NSrHrEQXWyTiwRfEGWz3cj3eK7cLytUs6nb 8xGQLWE12lXGbsXi22jH7gnn8JKKyTaIgFaqBnpFbcV9zVp+BIR0441iapmkLwl556LM E5zNK34RoKs+vjk3HoOvoG7ydWnXLplcL3ZAcEKM2pVTGjJuZRgfOYc6KCN3y959/VEg n6BMlLZBtjUqT5aqDq2Pk0GmKqhasJ2lZt7bR9ZmD9bS6OD0CLMsxwy5o9aWrGR98B8o y9KQ== X-Gm-Message-State: AA+aEWaAfBgstlG0SGRjbLQMl9QeEhhStW7dRSTTqNrcLdR3eaTHJeXc jFh9KVnnw8s7zKzAVqeax5yOKZb7 X-Google-Smtp-Source: AFSGD/XX2xskwcNfdCo5ik0kcqHFiGTcWi+FmK5RokSHZ/VIKxj+gbyMqGIBWMdA3AdR26eos9nE5Q== X-Received: by 2002:a1c:7fca:: with SMTP id a193mr6757758wmd.36.1544628238084; Wed, 12 Dec 2018 07:23:58 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:56 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:58 +0100 Message-Id: <1544628195-37728-38-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL 37/54] audio/alsaaudio: Remove compiler check around pragma 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth Both GCC v4.8 and Clang v3.4 support the -Waddress option, so we do not need the compiler version check here anymore. Signed-off-by: Thomas Huth Reviewed-by: Richard Henderson Message-Id: <1543937577-28256-6-git-send-email-thuth@redhat.com> --- audio/alsaaudio.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 362a227..635be73 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -28,9 +28,7 @@ #include "audio.h" #include "trace.h" -#if QEMU_GNUC_PREREQ(4, 3) #pragma GCC diagnostic ignored "-Waddress" -#endif #define AUDIO_CAP "alsa" #include "audio_int.h" From patchwork Wed Dec 12 15:22:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726613 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 C7D2A174F for ; Wed, 12 Dec 2018 15:49:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0428329BA8 for ; Wed, 12 Dec 2018 15:49:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EA05B29BF5; Wed, 12 Dec 2018 15:49:05 +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 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 9351829BA8 for ; Wed, 12 Dec 2018 15:49:05 +0000 (UTC) Received: from localhost ([::1]:45694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6ky-0005GR-QI for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:49:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6Mv-0001Ev-FI for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6Mm-0000VX-CK for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:09 -0500 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:53232) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6Mi-0000SW-I0 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:00 -0500 Received: by mail-wm1-x32b.google.com with SMTP id m1so5558969wml.2 for ; Wed, 12 Dec 2018 07:24:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=jRDJh6n72NiOdDg9JNmVEjwMxX8xkhSqlAWWMWaV7YE=; b=VJQlunQmp0XD/TLeni7UWh67PmrgaOwY9bY1avgxkkCcUMHYRDKGh/lRileY99RYsx bC9/FrJqkvMd1bhTa/5ycAR2Ql4KljpYxbE3qBeR7TDO2AsEZlJ7aNEKv5oBReYW3NUn 4BEjJQFc1dSsFSLY17M6fqrX0ubu4C9/zNW380FnhtmZvjMhNzvFu/tcRnfBr0Tg7gVo sPzJgJ3AW32fB1RBqgvZ/Vn+DBgK6SBNaoCfnsfY2+cI7mLsAGIxkozNBfvT48JBMNwi f8BNJuj3MO5ieDwWTNa3d+upwN7/PJAAxMj9/YBcRaepV6Byt/1t8uHaIVPKeZY0Brg1 e+Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=jRDJh6n72NiOdDg9JNmVEjwMxX8xkhSqlAWWMWaV7YE=; b=X40XW3A5m/Z1ocyn3WjYdHei7/Mh09BI2R79IwBsIFQGERmiOrhk/gHVP7eISQZJ1z jyGr50oUgJQ8mG25kqZOKBK6zE4FEGPG9AfxKJzU845HCRoRRuxI6uInU6OdebvcKMzL EU9F6+7Vb611o6+Hp2kuxWgGpx/LmvjqOYFAlBeTzz2TxDyJqSu2YnDya8WleeORfhlY bGhyn3kLw3blMzpD47rVxcX+j8ojJpJwXo6GX9+l3Lc784GG0xUV5bVKtJgrAGb8u16L 2vmWheHWftCc/j+Z4M5t0KRdoYaqcMd4pwpAc5J2j7+rNvqnK85mr5A4AxRwpKsdw08U s8kQ== X-Gm-Message-State: AA+aEWYJgZDPLNcnrSgehUnz8rW60ZZswbD5a7n1AR9WFQZ6OYdA7dk4 IShGcPQRaFX+jIUDW/RWi97XWxh/ X-Google-Smtp-Source: AFSGD/VArznD4Skh4cLjPqxBS117jAeEiGrV4bctCl836Vrwy6AR3SKO6BDlwTz1yEQyeTq29do9MA== X-Received: by 2002:a7b:c397:: with SMTP id s23mr4619281wmj.127.1544628239105; Wed, 12 Dec 2018 07:23:59 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:58 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:22:59 +0100 Message-Id: <1544628195-37728-39-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32b Subject: [Qemu-devel] [PULL 38/54] includes: Replace QEMU_GNUC_PREREQ with "__has_builtin || !defined(__clang__)" 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth Since we require GCC version 4.8 or newer now, we can be sure that the builtin functions are always available on GCC. And for Clang, we can check the availablility with __has_builtin instead. Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1543937577-28256-7-git-send-email-thuth@redhat.com> --- include/qemu/compiler.h | 2 +- include/qemu/host-utils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index 6f32ec2..a1e50ed 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -135,7 +135,7 @@ #define __has_builtin(x) 0 /* compatibility with non-clang compilers */ #endif -#if __has_builtin(__builtin_assume_aligned) || QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_assume_aligned) || !defined(__clang__) #define HAS_ASSUME_ALIGNED #endif diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 38da849..4cd170e 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -207,7 +207,7 @@ static inline int cto64(uint64_t val) */ static inline int clrsb32(uint32_t val) { -#if QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_clrsb) || !defined(__clang__) return __builtin_clrsb(val); #else return clz32(val ^ ((int32_t)val >> 1)) - 1; @@ -223,7 +223,7 @@ static inline int clrsb32(uint32_t val) */ static inline int clrsb64(uint64_t val) { -#if QEMU_GNUC_PREREQ(4, 7) +#if __has_builtin(__builtin_clrsbll) || !defined(__clang__) return __builtin_clrsbll(val); #else return clz64(val ^ ((int64_t)val >> 1)) - 1; From patchwork Wed Dec 12 15:23:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726625 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 C7F2614BD for ; Wed, 12 Dec 2018 15:52:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B808F2B261 for ; Wed, 12 Dec 2018 15:52:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC43A2B4CA; Wed, 12 Dec 2018 15:52: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 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 43A712B261 for ; Wed, 12 Dec 2018 15:52:13 +0000 (UTC) Received: from localhost ([::1]:45711 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6o0-0007mo-9h for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:52:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N7-0001N8-Ti for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N3-0000eP-7T for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:25 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:43625) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N1-0000Ti-4S for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:21 -0500 Received: by mail-wr1-x433.google.com with SMTP id r10so18077851wrs.10 for ; Wed, 12 Dec 2018 07:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7CsWX1EAofEiX1IoU6YOapLupjZR3p0MGFjj6fe9loc=; b=AjbdtjQLZEqrrNhuLelf4TzgHSY7bj6fThhCd4lhVHCGbmTDpNRSE0JZrOJK7cOoT5 KIchqap0xKVSFxs+9PkCYXtut5/LcTD2eB0oJPLidHGWUFTcBxPpjBkwUltcYc8c/fYc XfOIiTAis+bBUh6TV1/Q/mezByzzvNifw0BL32BAw7nzi0tb1uAqSVV+QyA3/9+3a1bd 3+5vxPp/wkkwm3CHlSJ8QoxXcnc84UiKbkXr5l8h8aEtA50ZqGu+WfW/HHM7MbARY7z5 TzjxU0N26ifnAKrQujBD7Bm+20bOjqCnrnhBj69431v0mcLNGcaCpc+QYeuy9U+L0P7R w6Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7CsWX1EAofEiX1IoU6YOapLupjZR3p0MGFjj6fe9loc=; b=PIH1hgowV/Tg2sgs8VbLMdyIij/2hJBUhaNsqY0RSDknwfVXlFEnC4kXKbVHvKxan1 UXFc0Qi+Bir5USp8rouzKFvM91py8IFRzDzT5CWvP3ojNZDEAlfkzPJn6vFXyRj6tQsl q1YYw6vfpwOL0zzoBtr2x7h5E8NBwHEiQkyyI5Qh87rTs30KhBreo5NIkK8Un3nNOG4V RpppM7uReSNPtm3J7CfRiTg3Tcz9cBATOkVhPjAVGTymTqMopIFlPZAsiSI2PydQQwsy oGrGI43fUvC39W5u0nHzO8B/WuU7oGn0OR27lx8ohgsgJl8HDUZtlWWegzi3IVWV6AWC NVwA== X-Gm-Message-State: AA+aEWYTaRRpoUmNMMYUHqlilXPACPoBfyiebHp+BJ3cErFnRNSyJO9c HcbgaIkvKjbo09u2CtfdNarMB47O X-Google-Smtp-Source: AFSGD/WvzCLISFc+oEJ/iS+jAn7ryd10/VgoOIZSpc5NtHraK/yoVb81mA5X2qPi9KEyjjdfAwP5BA== X-Received: by 2002:a05:6000:1251:: with SMTP id j17mr17374927wrx.315.1544628240104; Wed, 12 Dec 2018 07:24:00 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.23.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:23:59 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:00 +0100 Message-Id: <1544628195-37728-40-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 39/54] Remove QEMU_ARTIFICIAL macro 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: Thomas Huth Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thomas Huth The code that used it has already been removed a while ago with commit dc41aa7d34989b552ef ("tcg: Remove GET_TCGV_* and MAKE_TCGV_*"). Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth Message-Id: <1543937577-28256-8-git-send-email-thuth@redhat.com> --- include/qemu/compiler.h | 6 ------ scripts/checkpatch.pl | 1 - scripts/cocci-macro-file.h | 1 - 3 files changed, 8 deletions(-) diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h index a1e50ed..2dffc66 100644 --- a/include/qemu/compiler.h +++ b/include/qemu/compiler.h @@ -36,12 +36,6 @@ #define QEMU_SENTINEL __attribute__((sentinel)) -#if QEMU_GNUC_PREREQ(4, 3) -#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial)) -#else -#define QEMU_ARTIFICIAL -#endif - #if defined(_WIN32) # define QEMU_PACKED __attribute__((gcc_struct, packed)) #else diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b4b3495..440d95d 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -226,7 +226,6 @@ our $Attribute = qr{ QEMU_NORETURN| QEMU_WARN_UNUSED_RESULT| QEMU_SENTINEL| - QEMU_ARTIFICIAL| QEMU_PACKED| GCC_FMT_ATTR }x; diff --git a/scripts/cocci-macro-file.h b/scripts/cocci-macro-file.h index 1cb0b4a..e485cdc 100644 --- a/scripts/cocci-macro-file.h +++ b/scripts/cocci-macro-file.h @@ -23,7 +23,6 @@ #define QEMU_NORETURN __attribute__ ((__noreturn__)) #define QEMU_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) #define QEMU_SENTINEL __attribute__((sentinel)) -#define QEMU_ARTIFICIAL __attribute__((always_inline, artificial)) #define QEMU_PACKED __attribute__((gcc_struct, packed)) #define cat(x,y) x ## y From patchwork Wed Dec 12 15:23:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726633 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 43743174F for ; Wed, 12 Dec 2018 15:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F40428113 for ; Wed, 12 Dec 2018 15:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 202672B3A6; Wed, 12 Dec 2018 15:55:06 +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 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 8D19728113 for ; Wed, 12 Dec 2018 15:55:05 +0000 (UTC) Received: from localhost ([::1]:45724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6qm-00021L-Mo for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:55:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NG-9U for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N3-0000e7-5T for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:38475) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N1-0000Tx-15 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:21 -0500 Received: by mail-wr1-x42f.google.com with SMTP id v13so18111224wrw.5 for ; Wed, 12 Dec 2018 07:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=7PsksNWoHejU852i6cVb4FcQujJbTtshZdAeL19mv/g=; b=PkEY4WcMjQHc4o6DTmVyWrUqT68AJGEoxREsVcM5mIORNFTiyEF7/BdhVMXcjCEBrI +OhI/wvQuv9+XZZhI1MnS1F6cABNPuO1IlDhYGU3VmncX0PJXW/k/nCL9z0wd/8cFbkW lTryMInbim5c6zu13XcbIBt/dVbwlnSHs/BgDeZ3uDwO3NlSqPjkOQIR4l4aQTC1FQyG KIE5Lv1EXtP2XlaXzz07iteE3LiqYHvsV240oSqwdgEHEqHl64Bqm65J0J3erkawLpDB 7DC8O0VPDtYCOzywroHp4kFg0+SRHNXRkSmAodQwmtxS8u17wIXAAnxbhHxfxHirSWCq E66g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=7PsksNWoHejU852i6cVb4FcQujJbTtshZdAeL19mv/g=; b=LyhF/3sk2RcLb29+1iCjR6xmDmnD+JRLO/N2eRyw+ypONVixqdDY2TNhT1cIG07FU3 cWhg4NWAUWwbR1DQtf66cyH76o0yoioLFS598v2B7Xit1LZuZfHoxfL0PXJvgPM0xpjH gMCu1NCeqmy0nx+wG+jzqfWpUkKLDlqbGzIRR9Px3HDpaEFuvD3C+DEg3TAEjaMkfaBY QqbOfUsXpAMflCYuCHIHBTV6TAtv61lJt7DdsEXifQ5CWc+R2nYcWNy2fgiHdWmQpjMq CMfi9kv6HW3E9eB7s9u6+BxlGfL5drb+zIe/EljmAxiIld+y0LbDs0gg5bnQ2psdC4XN yx6g== X-Gm-Message-State: AA+aEWatrhX76jrlrzvsRgVoxh6aPD3emWotqVm7lWlbkVB+i5/hJseh spIoYn3X2PXbtcg/uf8z5QMf8otV X-Google-Smtp-Source: AFSGD/XPHaEssT1QfthPn5FHUDM0EZH/TnrJnXjDadSjX/MDu1k9Y6Ui4V3/pOv0khNvcD4AnRkXBQ== X-Received: by 2002:adf:df01:: with SMTP id y1mr18508625wrl.127.1544628240909; Wed, 12 Dec 2018 07:24:00 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:01 +0100 Message-Id: <1544628195-37728-41-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42f Subject: [Qemu-devel] [PULL 40/54] hw/watchdog/wdt_i6300esb : remove a unnecessary comment 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: Peng Hao Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Peng Hao The registered memory region of i6300esb is not suitable for coalesced mmio, because a write for the region may trigger an immediate action and can't be delayed. Signed-off-by: Peng Hao Message-Id: <1544253511-82742-1-git-send-email-peng.hao2@zte.com.cn> Signed-off-by: Paolo Bonzini --- hw/watchdog/wdt_i6300esb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index 7b59469..1c6eddf 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -449,7 +449,6 @@ static void i6300esb_realize(PCIDevice *dev, Error **errp) memory_region_init_io(&d->io_mem, OBJECT(d), &i6300esb_ops, d, "i6300esb", 0x10); pci_register_bar(&d->dev, 0, 0, &d->io_mem); - /* qemu_register_coalesced_mmio (addr, 0x10); ? */ } static void i6300esb_exit(PCIDevice *dev) From patchwork Wed Dec 12 15:23:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726651 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 E105B174F for ; Wed, 12 Dec 2018 16:02:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D27C12B5E8 for ; Wed, 12 Dec 2018 16:02:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D10282B752; Wed, 12 Dec 2018 16:02:14 +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 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 32D3E2B5E8 for ; Wed, 12 Dec 2018 16:02:14 +0000 (UTC) Received: from localhost ([::1]:45765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6xh-0007qL-B7 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:02:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52733) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NF-9J for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000fp-Gd for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:38478) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000Ux-5Y for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x432.google.com with SMTP id v13so18111319wrw.5 for ; Wed, 12 Dec 2018 07:24:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=svxHMm89H++K7kq7zcKWU4xe69K6HIgJULl2pjVcnGI=; b=r6636yIjqfPlNa2ABkrB3VidhkpzgkGcABGpgIBaeGabUFEB8XR/wK0/qs4Az41TNQ DPL2mkARWub2mufH6A+iPLpbX51iWtqzfDdYIcUYvL+y4nRcL1P6QsUM0uk1PsXKi6gS QBcv0NgNdnQQMVCtR8A1FNLXAiSvRxAcq4ksHHuG3C7Qtu+3zuPSJPwJDZ9ijo9plLnK zGAAEpplnaXa/6lwsJdAo1xkcmTOmJLQXEDVyh49JekyD1TaLdu4F+raG3pTL3QuuN7P pQUbWc4u6x48n3odfETd6LLzWP83e4c6tPQpm4qMpuUDMa/WYMpYeXFUzHLSPLVgUanL GBtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=svxHMm89H++K7kq7zcKWU4xe69K6HIgJULl2pjVcnGI=; b=jK41v0vxRvSZH4KOP4TU2r83B+SEi4Me5+r1MuQ9GfZyNmIQ2nFV95+Lt6gVRZe1e8 wXuQkcfNwuxLZiFT/8IQusFelCPGO5boaPMXeJyhbgsaxJjR/k3mv30icFAmL9buG2ia MA9Bk1oJ+KA6cSasL1SqFoQBr0QVaC21zmrvemEfA50aKQjdD/J+Y4Zihk+nRbFsSWR6 SfGuig4dq2W/sMEYYmIAVGOL71Ux72bV7QxcJTMI+cLrdL+L0OtmAVp4HZRCCruiVJkd l+ONKrjKbBo/g2DYhLhMjUGuJR59o20lxeOdgyXeY+uZyl96+psfAOJOQmXrCFkEXWgv OQpg== X-Gm-Message-State: AA+aEWYLuboAnPJ3/QkZiUBHM5+cwOznKiVebm/sWffRBPVSmx6mlJqa CczoELXBOkxQRGZmCI+T0ndvjvEU X-Google-Smtp-Source: AFSGD/U9WVmCxFK19YWL5VqKkRFMvYZXiSrt8TyBuhju1ywDIPmd9Jl5VN/YyEHHolpVCyN1rhVn1g== X-Received: by 2002:adf:eb45:: with SMTP id u5mr16720748wrn.102.1544628242481; Wed, 12 Dec 2018 07:24:02 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:01 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:02 +0100 Message-Id: <1544628195-37728-42-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::432 Subject: [Qemu-devel] [PULL 41/54] vhost-net: move stubs to a separate file 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP There is no reason for CONFIG_VHOST_NET to be specific to a single target; it is a host feature that can be add to all targets, as long as they support the virtio-net device. Currently CONFIG_VHOST_NET depends on CONFIG_KVM, but ioeventfd support is present in the core memory API and works with other accelerators as well. As a first step, move the vhost-net stubs to a separate file. Later, they will become conditional on CONFIG_VIRTIO_NET, which is not available in .c files. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-2-git-send-email-pbonzini@redhat.com> --- hw/net/Makefile.objs | 4 ++- hw/net/vhost_net-stub.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++ hw/net/vhost_net.c | 74 --------------------------------------- 3 files changed, 95 insertions(+), 75 deletions(-) create mode 100644 hw/net/vhost_net-stub.c diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs index fa461d4..c2705e6 100644 --- a/hw/net/Makefile.objs +++ b/hw/net/Makefile.objs @@ -37,7 +37,9 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o obj-$(CONFIG_VIRTIO_NET) += virtio-net.o -obj-y += vhost_net.o +obj-$(CONFIG_VHOST_NET) += vhost_net.o +common-obj-$(call lnot,$(CONFIG_VHOST_NET)) += vhost_net-stub.o +common-obj-$(CONFIG_ALL) += vhost_net-stub.o obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \ fsl_etsec/rings.o fsl_etsec/miim.o diff --git a/hw/net/vhost_net-stub.c b/hw/net/vhost_net-stub.c new file mode 100644 index 0000000..aac0e98 --- /dev/null +++ b/hw/net/vhost_net-stub.c @@ -0,0 +1,92 @@ +/* + * vhost-net support + * + * Copyright Red Hat, Inc. 2010 + * + * Authors: + * Michael S. Tsirkin + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "net/net.h" +#include "net/tap.h" +#include "net/vhost-user.h" + +#include "hw/virtio/virtio-net.h" +#include "net/vhost_net.h" +#include "qemu/error-report.h" + + +uint64_t vhost_net_get_max_queues(VHostNetState *net) +{ + return 1; +} + +struct vhost_net *vhost_net_init(VhostNetOptions *options) +{ + error_report("vhost-net support is not compiled in"); + return NULL; +} + +int vhost_net_start(VirtIODevice *dev, + NetClientState *ncs, + int total_queues) +{ + return -ENOSYS; +} +void vhost_net_stop(VirtIODevice *dev, + NetClientState *ncs, + int total_queues) +{ +} + +void vhost_net_cleanup(struct vhost_net *net) +{ +} + +uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) +{ + return features; +} + +void vhost_net_ack_features(struct vhost_net *net, uint64_t features) +{ +} + +uint64_t vhost_net_get_acked_features(VHostNetState *net) +{ + return 0; +} + +bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) +{ + return false; +} + +void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, + int idx, bool mask) +{ +} + +int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr) +{ + return -1; +} + +VHostNetState *get_vhost_net(NetClientState *nc) +{ + return 0; +} + +int vhost_set_vring_enable(NetClientState *nc, int enable) +{ + return 0; +} + +int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu) +{ + return 0; +} diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e037db6..b901306 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -23,7 +23,6 @@ #include "qemu/error-report.h" -#ifdef CONFIG_VHOST_NET #include #include #include @@ -449,76 +448,3 @@ int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu) return vhost_ops->vhost_net_set_mtu(&net->dev, mtu); } - -#else -uint64_t vhost_net_get_max_queues(VHostNetState *net) -{ - return 1; -} - -struct vhost_net *vhost_net_init(VhostNetOptions *options) -{ - error_report("vhost-net support is not compiled in"); - return NULL; -} - -int vhost_net_start(VirtIODevice *dev, - NetClientState *ncs, - int total_queues) -{ - return -ENOSYS; -} -void vhost_net_stop(VirtIODevice *dev, - NetClientState *ncs, - int total_queues) -{ -} - -void vhost_net_cleanup(struct vhost_net *net) -{ -} - -uint64_t vhost_net_get_features(struct vhost_net *net, uint64_t features) -{ - return features; -} - -void vhost_net_ack_features(struct vhost_net *net, uint64_t features) -{ -} - -uint64_t vhost_net_get_acked_features(VHostNetState *net) -{ - return 0; -} - -bool vhost_net_virtqueue_pending(VHostNetState *net, int idx) -{ - return false; -} - -void vhost_net_virtqueue_mask(VHostNetState *net, VirtIODevice *dev, - int idx, bool mask) -{ -} - -int vhost_net_notify_migration_done(struct vhost_net *net, char* mac_addr) -{ - return -1; -} - -VHostNetState *get_vhost_net(NetClientState *nc) -{ - return 0; -} - -int vhost_set_vring_enable(NetClientState *nc, int enable) -{ - return 0; -} - -int vhost_net_set_mtu(struct vhost_net *net, uint16_t mtu) -{ - return 0; -} -#endif From patchwork Wed Dec 12 15:23:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726653 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 9DE5515A6 for ; Wed, 12 Dec 2018 16:02:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CACC2B73D for ; Wed, 12 Dec 2018 16:02:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 805E22B77C; Wed, 12 Dec 2018 16:02:41 +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 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 E86952B5A4 for ; Wed, 12 Dec 2018 16:02:40 +0000 (UTC) Received: from localhost ([::1]:45766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6y8-000863-4v for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:02:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NB-8h for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000gJ-QY for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:32987) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000VT-Gm for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x42c.google.com with SMTP id c14so18140341wrr.0 for ; Wed, 12 Dec 2018 07:24:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Kt9LRbUX09IIIch7Z0t136rWpbfoZ1ACx9RxV5pLWFA=; b=O447wrndx5IgtgdCR+hWKQUT1SNTKZhqejY7lq5oDujl2poG/L91LXfPn2UKL6OCPU uWunF/MubVx3K1mMwhDmHo75BFdSF6Yu8Sz856CrZ2O6odmeyqaXWeqyqfA2mRu65R+w 8cQGmA1VFx1r9OeSBJeStyy8gvtxv1GyHw/CoNw+7d+gAO/SPPJDEX4WcE732pb7/v1S dZ5pnyNsSL1WGvQZ6DiGKwMC2PrLPA+QQftcG2cB40pLfqCXLoOTxb5JdBRFQ6duup5+ pqUBkn+9C1kteQ6hvOWe6S6ImAr9JTTbhoC9O8TxqSLiEkiKlRq3J8e4U92jLroTE5vH 2SRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=Kt9LRbUX09IIIch7Z0t136rWpbfoZ1ACx9RxV5pLWFA=; b=A7S/YASuSpv9xd+ZVIuWP1mlzS5fWiVeF4AXepXCtI5SNBFxU+1uaQTPnXa+RIEbLY GQeVRAkhT5HjvjTxeDryIJpMQIbtMM+XG+VL5SuDFxzGcz8O1NYJoLYMd9gF9PahPnCH cOAvwRCsZOyB19Yt/mC3GshMeBmI8+Wp96I9QAbMEpJBxx9HdSznboAwBwNEZv81rdF3 XkpFqkFy0aCYgl/vqr2FuCI0dE4mDYXJR6gYgglvgiOhF7shRzZtAw914LPiek/2FDQm zYo2QnF2JKvadqhnVSlHiozNqszYvOmvfi3XlcfYbEuZBozd7uWBWk75n4MwwfMeNfeK rSUg== X-Gm-Message-State: AA+aEWa3RMjlv4/h6berIdpHU0WOrZ0NJnLOgF87RctReEts+/kNX9ub Z/pDkk8KNLDnY9jcwunUCDCk4mfU X-Google-Smtp-Source: AFSGD/XCAZ6LRMZP8VYiVjJMoLzXVaVp4MCUVLD0o+iNufmB5ordV7yAtc8yF3MybOzfRvoEYWY8Kw== X-Received: by 2002:adf:db51:: with SMTP id f17mr16619540wrj.90.1544628243479; Wed, 12 Dec 2018 07:24:03 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:02 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:03 +0100 Message-Id: <1544628195-37728-43-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c Subject: [Qemu-devel] [PULL 42/54] vhost-net-user: add stubs for when no virtio-net device is present 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP hw/net/vhost_net.c needs functions that are declared in net/vhost-user.c: the vhost-user code is always compiled into QEMU, only the constructor net_init_vhost_user is unreachable. Also, net/vhost-user.c needs functions declared in hw/virtio/vhost-stub.c even if no virtio device exists. Break this dependency. First, add a minimal version of net/vhost-user.c, with no functionality and no dependency on vhost code. Second, #ifdef out the calls back to net/vhost-user.c from hw/net/vhost_net.c. While at it, this patch fixes the CONFIG_VHOST_NET_USE*D* typo. Reviewed-by: Philippe Mathieu-Daudé Message-Id: <1543851204-41186-3-git-send-email-pbonzini@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Paolo Bonzini --- configure | 2 +- hw/net/vhost_net.c | 4 ++++ net/Makefile.objs | 4 +++- net/net.c | 2 +- net/vhost-user-stub.c | 23 +++++++++++++++++++++++ 5 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 net/vhost-user-stub.c diff --git a/configure b/configure index 131eae5..b995d71 100755 --- a/configure +++ b/configure @@ -6515,7 +6515,7 @@ if test "$vhost_scsi" = "yes" ; then echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak fi if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then - echo "CONFIG_VHOST_NET_USED=y" >> $config_host_mak + echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak fi if test "$vhost_crypto" = "yes" ; then echo "CONFIG_VHOST_CRYPTO=y" >> $config_host_mak diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index b901306..2a300ee 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -193,6 +193,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) } /* Set sane init value. Override when guest acks. */ +#ifdef CONFIG_VHOST_NET_USER if (net->nc->info->type == NET_CLIENT_DRIVER_VHOST_USER) { features = vhost_user_get_acked_features(net->nc); if (~net->dev.features & features) { @@ -202,6 +203,7 @@ struct vhost_net *vhost_net_init(VhostNetOptions *options) goto fail; } } +#endif vhost_net_ack_features(net, features); @@ -413,10 +415,12 @@ VHostNetState *get_vhost_net(NetClientState *nc) case NET_CLIENT_DRIVER_TAP: vhost_net = tap_get_vhost_net(nc); break; +#ifdef CONFIG_VHOST_NET_USER case NET_CLIENT_DRIVER_VHOST_USER: vhost_net = vhost_user_get_vhost_net(nc); assert(vhost_net); break; +#endif default: break; } diff --git a/net/Makefile.objs b/net/Makefile.objs index b2bf88a..df2b409 100644 --- a/net/Makefile.objs +++ b/net/Makefile.objs @@ -3,7 +3,9 @@ common-obj-y += socket.o common-obj-y += dump.o common-obj-y += eth.o common-obj-$(CONFIG_L2TPV3) += l2tpv3.o -common-obj-$(CONFIG_POSIX) += vhost-user.o +common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET_USER)) += vhost-user.o +common-obj-$(call land,$(call lnot,$(CONFIG_VIRTIO_NET)),$(CONFIG_VHOST_NET_USER)) += vhost-user-stub.o +common-obj-$(CONFIG_ALL) += vhost-user-stub.o common-obj-$(CONFIG_SLIRP) += slirp.o common-obj-$(CONFIG_VDE) += vde.o common-obj-$(CONFIG_NETMAP) += netmap.o diff --git a/net/net.c b/net/net.c index 3acbdcc..ca0e14c 100644 --- a/net/net.c +++ b/net/net.c @@ -961,7 +961,7 @@ static int (* const net_client_init_fun[NET_CLIENT_DRIVER__MAX])( [NET_CLIENT_DRIVER_BRIDGE] = net_init_bridge, #endif [NET_CLIENT_DRIVER_HUBPORT] = net_init_hubport, -#ifdef CONFIG_VHOST_NET_USED +#ifdef CONFIG_VHOST_NET_USER [NET_CLIENT_DRIVER_VHOST_USER] = net_init_vhost_user, #endif #ifdef CONFIG_L2TPV3 diff --git a/net/vhost-user-stub.c b/net/vhost-user-stub.c new file mode 100644 index 0000000..52ab4e1 --- /dev/null +++ b/net/vhost-user-stub.c @@ -0,0 +1,23 @@ +/* + * vhost-user-stub.c + * + * Copyright (c) 2018 Red Hat, Inc. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "clients.h" +#include "net/vhost_net.h" +#include "net/vhost-user.h" +#include "qemu/error-report.h" +#include "qapi/error.h" + +int net_init_vhost_user(const Netdev *netdev, const char *name, + NetClientState *peer, Error **errp) +{ + error_setg(errp, "vhost-user requires frontend driver virtio-net-*"); + return -1; +} From patchwork Wed Dec 12 15:23:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726647 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 A3FBD6C5 for ; Wed, 12 Dec 2018 15:59:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94BB62A2B0 for ; Wed, 12 Dec 2018 15:59:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8616F2A311; Wed, 12 Dec 2018 15:59:22 +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 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 053052A2B0 for ; Wed, 12 Dec 2018 15:59:22 +0000 (UTC) Received: from localhost ([::1]:45739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6uv-0004DR-75 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:59:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001ND-9A for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000g7-OU for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:32991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000Vq-Du for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x430.google.com with SMTP id c14so18140375wrr.0 for ; Wed, 12 Dec 2018 07:24:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iz2cTrQ8mIfFHVYmYbwOLVbG0evK9NMaJklxa+5nmH8=; b=oCVhvUdboKHiK6qGBaiof9JRiREKOwjZ7u16EeTB2Ga7vsDXz23/146z0hGYyGuSFu OEQ0CkCVS9fRkcrL68UxIeB1q83aIryZGla+i4TzZprGuqmOd5O9Ou4+wn2boiNSCb4K YJI7mHjruFfbzWVrCY97A07lGhzH8ik4ge95B1sNhee5Xb++zaNkljtZC7UM9dgy/Hja 102PLRE12dde+q/CKrKzxKagfF9KPi3ScqUT6nIP3dE78KhlQXB7cjZNKVJsPz343GE5 odiy5Ce77oo2NT+xdmk3dbc3aNZKFUD9wfSoYyt6qkNv1PHLgcfMuhAW3awvdejSpYfy ZQMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iz2cTrQ8mIfFHVYmYbwOLVbG0evK9NMaJklxa+5nmH8=; b=fV9EywjFoTc20O4eHu50gDXq1YZWk/M9j2gZR0H4jjtcI5dQyd+mpLk6/Ib53V1PMy TbP+w/yRAbgFByvYDkjQSTmRdV52lsWnV0jysMp8726SpPEUmn8pUmbI8nQUS/zwA4Zw V4DjI1lQCjMfQczXw0CkTHNxMU+dJmuDpNAS1BnliaNM6HJtIBgjtkYhcaP7lyhDp/rL ISD59ipFNve/N83wPy/h+oMLE0FJOnA9k9Wy+ndway4jSiQ2dQgAsLbmfb1kBDZEzGP/ OH5PKH8CEQpIWFy+u2qiArSJB0Z29mjFPlq0B/DlgQG0YbVcT0yXZsTy27ZMnLDRBRp0 xqtw== X-Gm-Message-State: AA+aEWZS+6D3UJ9aGmBmsT0Jtr6fDzVyMviHBSKBgd4+VDoCU3zToIMc JmstWcJ0Jve736WJ+0zZMCkz17eS X-Google-Smtp-Source: AFSGD/WSzmZ9zHKd/+A8BEMOVaYSTI/2JkKjxfdVzkBDBs9CqVy1kiWyjOTxXEa29iLBdxbHCZrztA== X-Received: by 2002:adf:8b4d:: with SMTP id v13mr17135428wra.282.1544628244378; Wed, 12 Dec 2018 07:24:04 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:03 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:04 +0100 Message-Id: <1544628195-37728-44-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::430 Subject: [Qemu-devel] [PULL 43/54] vhost: restrict Linux dependency to kernel vhost 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP vhost-user does not depend on Linux; it can run on any POSIX system. Restrict vhost-kernel to Linux in hw/virtio/vhost-backend.c, everything else can be compiled on all POSIX systems. Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Thomas Huth Message-Id: <1543851204-41186-4-git-send-email-pbonzini@redhat.com> Signed-off-by: Paolo Bonzini --- backends/Makefile.objs | 5 ++--- default-configs/virtio.mak | 4 ++-- hw/virtio/Makefile.objs | 5 +++-- hw/virtio/vhost-backend.c | 11 +++++++++-- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/backends/Makefile.objs b/backends/Makefile.objs index 717fcbd..ff619d3 100644 --- a/backends/Makefile.objs +++ b/backends/Makefile.objs @@ -9,10 +9,9 @@ common-obj-$(CONFIG_POSIX) += hostmem-file.o common-obj-y += cryptodev.o common-obj-y += cryptodev-builtin.o -ifeq ($(CONFIG_VIRTIO),y) +ifeq ($(CONFIG_VIRTIO_CRYPTO),y) common-obj-y += cryptodev-vhost.o -common-obj-$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += \ - cryptodev-vhost-user.o +common-obj-$(CONFIG_VHOST_CRYPTO) += cryptodev-vhost-user.o endif common-obj-$(CONFIG_LINUX) += hostmem-memfd.o diff --git a/default-configs/virtio.mak b/default-configs/virtio.mak index 1304849..340050a 100644 --- a/default-configs/virtio.mak +++ b/default-configs/virtio.mak @@ -1,5 +1,5 @@ -CONFIG_VHOST_USER_SCSI=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) -CONFIG_VHOST_USER_BLK=$(call land,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) +CONFIG_VHOST_USER_SCSI=$(CONFIG_VHOST_USER) +CONFIG_VHOST_USER_BLK=$(CONFIG_VHOST_USER) CONFIG_VIRTIO=y CONFIG_VIRTIO_9P=y CONFIG_VIRTIO_BALLOON=y diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index 1b2799c..e8eff80 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -9,9 +9,10 @@ obj-$(CONFIG_VIRTIO_BALLOON) += virtio-balloon.o obj-$(CONFIG_VIRTIO_CRYPTO) += virtio-crypto.o obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-pci.o -obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o +obj-$(CONFIG_VHOST_USER) += vhost-user.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o +obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += vhost.o vhost-backend.o +common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))) += vhost-stub.o endif -common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO),$(CONFIG_LINUX))) += vhost-stub.o common-obj-$(CONFIG_ALL) += vhost-stub.o diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index 7f09efa..b5d2e30 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -9,12 +9,14 @@ */ #include "qemu/osdep.h" -#include -#include #include "hw/virtio/vhost.h" #include "hw/virtio/vhost-backend.h" #include "qemu/error-report.h" +#ifdef CONFIG_LINUX +#include +#include + static int vhost_kernel_call(struct vhost_dev *dev, unsigned long int request, void *arg) { @@ -265,18 +267,23 @@ static const VhostOps kernel_ops = { .vhost_set_iotlb_callback = vhost_kernel_set_iotlb_callback, .vhost_send_device_iotlb_msg = vhost_kernel_send_device_iotlb_msg, }; +#endif int vhost_set_backend_type(struct vhost_dev *dev, VhostBackendType backend_type) { int r = 0; switch (backend_type) { +#ifdef CONFIG_LINUX case VHOST_BACKEND_TYPE_KERNEL: dev->vhost_ops = &kernel_ops; break; +#endif +#ifdef CONFIG_VHOST_USER case VHOST_BACKEND_TYPE_USER: dev->vhost_ops = &user_ops; break; +#endif default: error_report("Unknown vhost backend type"); r = -1; From patchwork Wed Dec 12 15:23:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726661 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 B019915A6 for ; Wed, 12 Dec 2018 16:06:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D4322A396 for ; Wed, 12 Dec 2018 16:06:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E2D02B1BB; Wed, 12 Dec 2018 16:06:00 +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 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 238F82A396 for ; Wed, 12 Dec 2018 16:06:00 +0000 (UTC) Received: from localhost ([::1]:45783 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX71L-0002Uq-B2 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:05:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52837) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NA-0001Oi-Lc for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000gm-5o for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:39684) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000WP-RT for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wr1-x42e.google.com with SMTP id t27so18088635wra.6 for ; Wed, 12 Dec 2018 07:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eaD6PeZKhS5G9m0gX7jC6gRCbeIZg/pdbyn0Sr5U/i4=; b=S8lBQTjdTT1y2rG9/cMyzLMf/Jvt6nlTcq29Nn7EayLuFHl839GMwz2BhQq755jveH lFWpuGCS0JsRa5ZY14GBOR2hwN9s62ElXCZ0e/GGSTbbmVIzuNc1YauErNUxC5xentNz WcaEMNF0dtk2EeZGJwpOdRFXLXdvyzjjzHPxKhCaJcS1CVHgeNCl6yn1qgIEpNQxf9g2 Pxt9F+KwtUZr0AKkykZD1bPOVMyoNhwXrRGPj/EfOzG/f1i8ZAKlkjEwyebuzll6WiKL vRDeTcAsKBSIpN0pDw3PngKWeUrAtae50SigE157JQMT9BeYkQ260MhCpgVayDj9s4JA 2YFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=eaD6PeZKhS5G9m0gX7jC6gRCbeIZg/pdbyn0Sr5U/i4=; b=Bgdb66iQWuFuyq9Hq9EK0xs7JOocMtM9dJyC+lR+G7NSsvRpmBYgdacCu1ylWZgoWO ENwkI0D+yndCgLtTa4q/xRgnbqH3p6mhn+DDGeYOZpdTD6smIA5H6KvNLlNwIkWFw33I NUcOivbn2jZt1NnN9Q0prFRnNIcpgSH5n/hkpzA9eKgXwnaCf7hSJrhCQx9TEbTlxSrd Zi0aPkcTN+Dw1c92I6K+WKIYJK15mP42ZAoyYM+z16emm0YAfDPAidbKip5Fpu2M9FD1 JijLJ2caBuNR8rLwe4Z2nB6/hjojwQvaJiLeWOf5cDdtwhsI12zr06u4Gs8i5LxpLLPY 8r9w== X-Gm-Message-State: AA+aEWYyGtYtKZxKtXfqgUZBsielDmfJi4C1HrElw8pNC6nKjgUoPQ9m hYgM6C8LUcxgmlQGoXi+CHgTbwPB X-Google-Smtp-Source: AFSGD/VE/dIdZHSMMtQ3AHGn3+YZRz+F4UM2vSqHjVma0zPBFQn0rJ5JXxm/xZvPtJu6wmkc05GOlA== X-Received: by 2002:a5d:494a:: with SMTP id r10mr18335962wrs.272.1544628245263; Wed, 12 Dec 2018 07:24:05 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:04 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:05 +0100 Message-Id: <1544628195-37728-45-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42e Subject: [Qemu-devel] [PULL 44/54] vhost-net: compile it on all targets that have virtio-net. 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This shows a preexisting bug: if a KVM target did not have virtio-net enabled, it would fail with undefined symbols when vhost was enabled. This must now be fixed, lest targets that have no virtio-net fail to compile. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-Id: <1543851204-41186-5-git-send-email-pbonzini@redhat.com> --- configure | 11 ++++------- hw/net/Makefile.objs | 4 ++-- include/exec/poison.h | 1 - tests/Makefile.include | 5 +---- 4 files changed, 7 insertions(+), 14 deletions(-) diff --git a/configure b/configure index b995d71..b26e4de 100755 --- a/configure +++ b/configure @@ -6514,7 +6514,10 @@ fi if test "$vhost_scsi" = "yes" ; then echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak fi -if test "$vhost_net" = "yes" -a "$vhost_user" = "yes"; then +if test "$vhost_net" = "yes" ; then + echo "CONFIG_VHOST_NET=y" >> $config_host_mak +fi +if test "$vhost_net_user" = "yes" ; then echo "CONFIG_VHOST_NET_USER=y" >> $config_host_mak fi if test "$vhost_crypto" = "yes" ; then @@ -7276,12 +7279,6 @@ if supported_xen_target $target; then fi if supported_kvm_target $target; then echo "CONFIG_KVM=y" >> $config_target_mak - if test "$vhost_net" = "yes" ; then - echo "CONFIG_VHOST_NET=y" >> $config_target_mak - if test "$vhost_user" = "yes" ; then - echo "CONFIG_VHOST_USER_NET_TEST_$target_name=y" >> $config_host_mak - fi - fi fi if supported_hax_target $target; then echo "CONFIG_HAX=y" >> $config_target_mak diff --git a/hw/net/Makefile.objs b/hw/net/Makefile.objs index c2705e6..2d7ee0a 100644 --- a/hw/net/Makefile.objs +++ b/hw/net/Makefile.objs @@ -37,8 +37,8 @@ obj-$(CONFIG_PSERIES) += spapr_llan.o obj-$(CONFIG_XILINX_ETHLITE) += xilinx_ethlite.o obj-$(CONFIG_VIRTIO_NET) += virtio-net.o -obj-$(CONFIG_VHOST_NET) += vhost_net.o -common-obj-$(call lnot,$(CONFIG_VHOST_NET)) += vhost_net-stub.o +common-obj-$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET)) += vhost_net.o +common-obj-$(call lnot,$(call land,$(CONFIG_VIRTIO_NET),$(CONFIG_VHOST_NET))) += vhost_net-stub.o common-obj-$(CONFIG_ALL) += vhost_net-stub.o obj-$(CONFIG_ETSEC) += fsl_etsec/etsec.o fsl_etsec/registers.o \ diff --git a/include/exec/poison.h b/include/exec/poison.h index 32d5378..b158632 100644 --- a/include/exec/poison.h +++ b/include/exec/poison.h @@ -85,7 +85,6 @@ #pragma GCC poison CONFIG_XTENSA_DIS #pragma GCC poison CONFIG_LINUX_USER -#pragma GCC poison CONFIG_VHOST_NET #pragma GCC poison CONFIG_KVM #pragma GCC poison CONFIG_SOFTMMU diff --git a/tests/Makefile.include b/tests/Makefile.include index 62915e4..ecb3318 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -204,10 +204,7 @@ check-qtest-i386-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF) check-qtest-i386-y += tests/cpu-plug-test$(EXESUF) check-qtest-i386-y += tests/q35-test$(EXESUF) check-qtest-i386-y += tests/vmgenid-test$(EXESUF) -check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF) -ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),) -check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF) -endif +check-qtest-i386-$(CONFIG_VHOST_NET_USER) += tests/vhost-user-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-swtpm-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_CRB) += tests/tpm-crb-test$(EXESUF) check-qtest-i386-$(CONFIG_TPM_TIS) += tests/tpm-tis-swtpm-test$(EXESUF) From patchwork Wed Dec 12 15:23:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726673 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 588F813AF for ; Wed, 12 Dec 2018 16:14:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 487DA2AB4D for ; Wed, 12 Dec 2018 16:14:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3C9F82B5FD; Wed, 12 Dec 2018 16:14: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 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 89CAC2AB4D for ; Wed, 12 Dec 2018 16:14:12 +0000 (UTC) Received: from localhost ([::1]:45863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX79H-0001ZI-PU for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:14:11 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52858) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NB-0001P7-2A for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000hL-Fp for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:53174) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N6-0000XH-5D for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wm1-x341.google.com with SMTP id m1so5559419wml.2 for ; Wed, 12 Dec 2018 07:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kWW+XZv2DbIQ1hqtCKXSa176GVz8bhjRGVjlOeyFC60=; b=WCFoaD3kpoI5nXDULqPf7smxNuqihpiXkx3PcF4w1baySdMP+ox1apZIfMoFnEjwKn rkPB5AbHwDRwA14Ey/TE6YO4+23VAJCvgN2ZxG92+ogp+9cuNrFI6lXB6fGtOF5xdm28 UyhMVbJr3uOtupT6prROEJvvvmIMYl8nqgt+cefzg5drZ+scHVgm5dsbtqm2QEr7mDqM 5AeE0Qk095VWo5EvRJK+hDaAKh1JzOtIApDpz3Sa6KPcgWlbYqrXwPOTZgLue4vmcW4X bGN2wR0Cp4PElCXWSTa2DCnnWo1/C2cqLLzPbBxlnqgOKe/bUwbavBwBxkSs600cvSIP 1o5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=kWW+XZv2DbIQ1hqtCKXSa176GVz8bhjRGVjlOeyFC60=; b=oLoJ8K5xq8smNA6wYU1Ag/Q810jooNF4Ls6HhcvO57PhrAkgT6DsR0ibDf8m0+I9C9 bfjULHwxLTu7I/BVffY1qf3sCb2v27BKMunN3jFbqlJR2YyQahW+mANKUWODREmL656+ broE5srUyBfj8wKAq4IDLiMp3zdmYGd7yovK797O/8riM5SUwKxUB4abLstL0ygdtxzz xzNlx8LGGFFaS0wQDFVFybEeUUtkjwkfcEiVD0oy9RQAcBNO+ZuPDrgVRh8WBKl6I616 f+9anwyZ0LKL+iI3Y++tCMhqDIXRQ/CNq0kb8PkWu9k0FVZBve51gsqMfPQ7eHNpsnxx qYew== X-Gm-Message-State: AA+aEWZkgYEnLFYLsQLB7e3RVz4y4OxyN8K0rOLlRojM6JI7YwPDKyu9 LtRvzVw/Z6yg5Rqr0IdBycSVLOIe X-Google-Smtp-Source: AFSGD/Wc/gQeBNfvBWuMs8+1vMo9uEUwSXQhQpjxhW+XGn9cr8nLmk9D7cGAj5RzMa/ZkS/A2S1WVw== X-Received: by 2002:a1c:9cce:: with SMTP id f197mr6725878wme.135.1544628246788; Wed, 12 Dec 2018 07:24:06 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:05 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:06 +0100 Message-Id: <1544628195-37728-46-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 Subject: [Qemu-devel] [PULL 45/54] vhost-net: revamp configure logic 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Detect all invalid configurations (e.g. mingw32 with vhost-user, non-Linux with vhost-kernel). As a collateral benefit, all vhost-kernel backends can be now disabled if one wants to reduce the attack surface. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-Id: <1543851204-41186-6-git-send-email-pbonzini@redhat.com> --- configure | 89 +++++++++++++++++++++++++++++++---------------- hw/virtio/Makefile.objs | 4 +-- hw/virtio/vhost-backend.c | 4 +-- 3 files changed, 63 insertions(+), 34 deletions(-) diff --git a/configure b/configure index b26e4de..b076b43 100755 --- a/configure +++ b/configure @@ -366,10 +366,10 @@ libattr="" xfs="" tcg="yes" membarrier="" -vhost_net="no" -vhost_crypto="no" -vhost_scsi="no" -vhost_vsock="no" +vhost_net="" +vhost_crypto="" +vhost_scsi="" +vhost_vsock="" vhost_user="" kvm="no" hax="no" @@ -774,6 +774,7 @@ case $targetos in MINGW32*) mingw32="yes" hax="yes" + vhost_user="no" audio_possible_drivers="dsound sdl" if check_include dsound.h; then audio_drv_list="dsound" @@ -874,10 +875,6 @@ Linux) linux="yes" linux_user="yes" kvm="yes" - vhost_net="yes" - vhost_crypto="yes" - vhost_scsi="yes" - vhost_vsock="yes" QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES" supported_os="yes" libudev="yes" @@ -1255,11 +1252,7 @@ for opt do ;; --disable-vhost-crypto) vhost_crypto="no" ;; - --enable-vhost-crypto) - vhost_crypto="yes" - if test "$mingw32" = "yes"; then - error_exit "vhost-crypto isn't available on win32" - fi + --enable-vhost-crypto) vhost_crypto="yes" ;; --disable-vhost-scsi) vhost_scsi="no" ;; @@ -1460,11 +1453,11 @@ for opt do ;; --disable-vhost-user) vhost_user="no" ;; - --enable-vhost-user) - vhost_user="yes" - if test "$mingw32" = "yes"; then - error_exit "vhost-user isn't available on win32" - fi + --enable-vhost-user) vhost_user="yes" + ;; + --disable-vhost-kernel) vhost_kernel="no" + ;; + --enable-vhost-kernel) vhost_kernel="yes" ;; --disable-capstone) capstone="no" ;; @@ -1496,14 +1489,6 @@ for opt do esac done -if test "$vhost_user" = ""; then - if test "$mingw32" = "yes"; then - vhost_user="no" - else - vhost_user="yes" - fi -fi - case "$cpu" in ppc) CPU_CFLAGS="-m32" @@ -1728,8 +1713,12 @@ disabled with --disable-FEATURE, default is enabled if available: linux-aio Linux AIO support cap-ng libcap-ng support attr attr and xattr support - vhost-net vhost-net acceleration support - vhost-crypto vhost-crypto acceleration support + vhost-net vhost-net kernel acceleration support + vhost-vsock virtio sockets device support + vhost-scsi vhost-scsi kernel target support + vhost-crypto vhost-user-crypto backend support + vhost-kernel vhost kernel backend support + vhost-user vhost-user backend support spice spice rbd rados block device (rbd) libiscsi iscsi support @@ -1753,7 +1742,6 @@ disabled with --disable-FEATURE, default is enabled if available: jemalloc jemalloc support avx2 AVX2 optimization support replication replication support - vhost-vsock virtio sockets device support opengl opengl support virglrenderer virgl rendering support xfsctl xfsctl support @@ -1770,7 +1758,6 @@ disabled with --disable-FEATURE, default is enabled if available: parallels parallels image format support sheepdog sheepdog block driver support crypto-afalg Linux AF_ALG crypto backend driver - vhost-user vhost-user support capstone capstone disassembler support debug-mutex mutex debugging support libpmem libpmem support @@ -2157,6 +2144,45 @@ else l2tpv3=no fi +######################################### +# vhost interdependencies and host support + +# vhost backends +test "$vhost_user" = "" && vhost_user=yes +if test "$vhost_user" = "yes" && test "$mingw32" = "yes"; then + error_exit "vhost-user isn't available on win32" +fi +test "$vhost_kernel" = "" && vhost_kernel=$linux +if test "$vhost_kernel" = "yes" && test "$linux" != "yes"; then + error_exit "vhost-kernel is only available on Linux" +fi + +# vhost-kernel devices +test "$vhost_scsi" = "" && vhost_scsi=$vhost_kernel +if test "$vhost_scsi" = "yes" && test "$vhost_kernel" != "yes"; then + error_exit "--enable-vhost-scsi requires --enable-vhost-kernel" +fi +test "$vhost_vsock" = "" && vhost_vsock=$vhost_kernel +if test "$vhost_vsock" = "yes" && test "$vhost_kernel" != "yes"; then + error_exit "--enable-vhost-vsock requires --enable-vhost-kernel" +fi + +# vhost-user backends +test "$vhost_net_user" = "" && vhost_net_user=$vhost_user +if test "$vhost_net_user" = "yes" && test "$vhost_user" = "no"; then + error_exit "--enable-vhost-net-user requires --enable-vhost-user" +fi +test "$vhost_crypto" = "" && vhost_crypto=$vhost_user +if test "$vhost_crypto" = "yes" && test "$vhost_user" = "no"; then + error_exit "--enable-vhost-crypto requires --enable-vhost-user" +fi + +# OR the vhost-kernel and vhost-user values for simplicity +if test "$vhost_net" = ""; then + test "$vhost_net_user" = "yes" && vhost_net=yes + test "$vhost_kernel" = "yes" && vhost_net=yes +fi + ########################################## # MinGW / Mingw-w64 localtime_r/gmtime_r check @@ -6526,6 +6552,9 @@ fi if test "$vhost_vsock" = "yes" ; then echo "CONFIG_VHOST_VSOCK=y" >> $config_host_mak fi +if test "$vhost_kernel" = "yes" ; then + echo "CONFIG_VHOST_KERNEL=y" >> $config_host_mak +fi if test "$vhost_user" = "yes" ; then echo "CONFIG_VHOST_USER=y" >> $config_host_mak fi diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs index e8eff80..87402d1 100644 --- a/hw/virtio/Makefile.objs +++ b/hw/virtio/Makefile.objs @@ -11,8 +11,8 @@ obj-$(call land,$(CONFIG_VIRTIO_CRYPTO),$(CONFIG_VIRTIO_PCI)) += virtio-crypto-p obj-$(CONFIG_VHOST_USER) += vhost-user.o obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o -obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX)) += vhost.o vhost-backend.o -common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_LINUX))) += vhost-stub.o +obj-$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL)) += vhost.o vhost-backend.o +common-obj-$(call lnot,$(call lor,$(CONFIG_VHOST_USER),$(CONFIG_VHOST_KERNEL))) += vhost-stub.o endif common-obj-$(CONFIG_ALL) += vhost-stub.o diff --git a/hw/virtio/vhost-backend.c b/hw/virtio/vhost-backend.c index b5d2e30..46d388b 100644 --- a/hw/virtio/vhost-backend.c +++ b/hw/virtio/vhost-backend.c @@ -13,7 +13,7 @@ #include "hw/virtio/vhost-backend.h" #include "qemu/error-report.h" -#ifdef CONFIG_LINUX +#ifdef CONFIG_VHOST_KERNEL #include #include @@ -274,7 +274,7 @@ int vhost_set_backend_type(struct vhost_dev *dev, VhostBackendType backend_type) int r = 0; switch (backend_type) { -#ifdef CONFIG_LINUX +#ifdef CONFIG_VHOST_KERNEL case VHOST_BACKEND_TYPE_KERNEL: dev->vhost_ops = &kernel_ops; break; From patchwork Wed Dec 12 15:23:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726639 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 34C5A6C5 for ; Wed, 12 Dec 2018 15:56:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25C2728113 for ; Wed, 12 Dec 2018 15:56:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19F482B2C7; Wed, 12 Dec 2018 15:56:18 +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 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 B453828113 for ; Wed, 12 Dec 2018 15:56:17 +0000 (UTC) Received: from localhost ([::1]:45731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6rw-0002zV-Uh for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:56:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52735) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NH-9R for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000fZ-9w for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:46536) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N3-0000XV-Dq for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x434.google.com with SMTP id l9so18049536wrt.13 for ; Wed, 12 Dec 2018 07:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hICXc8HMZhgdE0qb9lHGLe+WYP+BV3i5De/QV94N0jA=; b=ZzbJzK0q0OvQj3CqLcf5w+TyScozEyy4Yc7XPzq+ldcG6t9AAzo0SJsmze7YmmnxX3 lu0osNDISTTCvnUDbrmTbR8RIuqS6bZ9h7PgxqaZZSOjS7Z9lZ8nbJmyMN1+wcsUaXhS YGbw6cgFPpYeBpVKtryw6pxgSRTzVNJEJyYUdb81UPXW2owYGS2f3xLnGLf7uheQdept nPRYIpWN8tf+/pHhT65wiPZKjVf+Qt+tvWRbwVq7E6+z0uT5huMFye5TjuGoFK29aslh QMLfH0YqIrjQmqL8kYuLM4TPfJzZSs1enxcAgD9mmjdRymWNNdTfecmqIkGTrhcD+/1I Emzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=hICXc8HMZhgdE0qb9lHGLe+WYP+BV3i5De/QV94N0jA=; b=MBpL/KTIWltfV0vVEwaxUAu82564OLtV9bUA9afLFxxzdW79QXevRhWqWnoxyM+CpV 2CLVdBER4Oj7YQQvFrdqcLiT1YeeywxmckUaGQwzinWZg88SigCRLKB1AdlMUMl9DujZ TxImwUsqJc+HxTfj6B/XKfsilJ9FSd0zi7ntImCuX00k6jNasbKRHZWaxCqCxWiJLEcg yVcI8JvYdfS9rbZCunqWE5/N+2nO6459S+SRWYgyCKLauX/zQvfE/uzYOdyMsFv+HARN 3vHmXi3ytppT988P9Jqw5kW3be8oY1274bIztOgr0NVJTvBBCbHgTkc0cSdk8U+sSPdR GZMw== X-Gm-Message-State: AA+aEWZB/eNScoC4YdJEjV/9BfymbnMEgoO6sRH84iYKXgYUz+tmADZ3 4fWlmCKgtQG51KNtCkGAAAOFNMd9 X-Google-Smtp-Source: AFSGD/XbFvSam+nfFv1nl4JFmj5c3WaGZRwCLr5r0JuXa43GGI92pQyTY8FuuKyumCnz15Lu+ymwDw== X-Received: by 2002:adf:ce86:: with SMTP id r6mr18664608wrn.257.1544628247525; Wed, 12 Dec 2018 07:24:07 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.06 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:07 +0100 Message-Id: <1544628195-37728-47-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::434 Subject: [Qemu-devel] [PULL 46/54] vhost-user-test: use g_cond_broadcast 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP g_cond_signal is rarely the right thing to do, it works now because vhost-user-test only has two threads but it is not correct in general. Fix it before adding more calls. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-7-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 45d58d8..656e519 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -393,7 +393,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) G_N_ELEMENTS(s->fds)); /* signal the test that it can continue */ - g_cond_signal(&s->data_cond); + g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_VRING_KICK: @@ -419,7 +419,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) p = (uint8_t *) &msg; qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE); - g_cond_signal(&s->data_cond); + g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_VRING_BASE: From patchwork Wed Dec 12 15:23:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726641 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 A0CB96C5 for ; Wed, 12 Dec 2018 15:58:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EDE82B2C7 for ; Wed, 12 Dec 2018 15:58:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8103E2B301; Wed, 12 Dec 2018 15:58:11 +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 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 212C42B2C7 for ; Wed, 12 Dec 2018 15:58:11 +0000 (UTC) Received: from localhost ([::1]:45733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6tl-0003Eq-Nr for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:58:09 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N9-0001NO-NN for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000ga-VV for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:27 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]:39692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000YH-MC for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x436.google.com with SMTP id t27so18088871wra.6 for ; Wed, 12 Dec 2018 07:24:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y2fv+KWYo+UI4pWKCC/32s4rVXG2cYD6i5ACzV+f4BE=; b=QtFg2r59233jEo+EED90xxM+5rmyQZKvC9mRpPz7JVdaunKJ9RttZoI7/0k4x1/h5h JszSE2UUtvRGhkwNIYI9Pnx3ujSCorPWEEn5+NKa72wE7+s4pFEVThe3U0H0jNfhWzCT +H3/Uklg17fctmXlcS8blRb1Yw+zvPWGMkdT1jmS+sfT7vnVcU8X9O1a+XIciW+rCS+7 zSa8yGeBf6uy/Kza+lWDkfMTtWlFN8NApiUU/tGcZ1k392SFyRjT/VftpHa7Ah3pfejR f7mteaWh77q93GIT/zVTlKyTuRlP1esu2HockULeNnBzFPJvL78GTlh1CIrE581QAIAd yU5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=y2fv+KWYo+UI4pWKCC/32s4rVXG2cYD6i5ACzV+f4BE=; b=lFJQOT92Iqnxm98ETbRe8TsY0J6FuAAbpwCXvNNTDDjbypOg2sJOgrV6Fs8/wVtllO tgE7hkBHSuJtq/ccqiv+VB0nLYirG2rM4hpRVQU8FDctbYAIxCjqc0ub3yhROvlW6qiA 8rz3cjDz7RW3KA55xM+NzPWpmI5EfZyWUysX3twLMvx5m4cq4285njRXWkkhh1Hz+MTG tvmv6Lyh+lixFBPGWpbRgVUxRp8+lqe4hb7Snga+UF8/UlTaWSrN3Set92sTrNDkGIuF aTd1O47F6f4sETI/1aNrTDBPBkFWw8IF4aanH0hNIPPqU0Y5FN26mbspNK3P76wX2cWf +nmA== X-Gm-Message-State: AA+aEWarPB3uBxPoxqy9R3EmTAOZMrFJeBKyyz+SIs/VSZ7bo7VpNwpv foJA2pGGwjTxLrrVO0bHL7RTc3sL X-Google-Smtp-Source: AFSGD/Ul5eifTQDY4E2wNl0u8kVyAyQOsP5vNil1LIK+b1JXoyPlKplHFZH8fLh2+uvKGvEPzwoVNQ== X-Received: by 2002:a05:6000:1251:: with SMTP id j17mr17375443wrx.315.1544628249046; Wed, 12 Dec 2018 07:24:09 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:07 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:08 +0100 Message-Id: <1544628195-37728-48-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::436 Subject: [Qemu-devel] [PULL 47/54] vhost-user-test: signal data_cond when s->rings changes 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This speeds up wait_for_rings_started, which currently is just waiting for the timeout before checking s->rings. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-8-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 656e519..6a805e6 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -384,6 +384,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) assert(msg.payload.state.index < s->queues * 2); s->rings &= ~(0x1ULL << msg.payload.state.index); + g_cond_broadcast(&s->data_cond); break; case VHOST_USER_SET_MEM_TABLE: @@ -425,6 +426,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) case VHOST_USER_SET_VRING_BASE: assert(msg.payload.state.index < s->queues * 2); s->rings |= 0x1ULL << msg.payload.state.index; + g_cond_broadcast(&s->data_cond); break; case VHOST_USER_GET_QUEUE_NUM: From patchwork Wed Dec 12 15:23:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726649 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 053B115A6 for ; Wed, 12 Dec 2018 16:01:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E75482B697 for ; Wed, 12 Dec 2018 16:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E585B2B5A1; Wed, 12 Dec 2018 16:01:15 +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 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 6FE972B516 for ; Wed, 12 Dec 2018 16:01:15 +0000 (UTC) Received: from localhost ([::1]:45761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6wk-0007Aa-I3 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:01:14 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N9-0001NL-Jj for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000h9-CX for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:27 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:40851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000Yq-Vk for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wm1-x336.google.com with SMTP id q26so6346596wmf.5 for ; Wed, 12 Dec 2018 07:24:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5rrzvUkpuCnqMHM9DLoYJ4yP3OmI6m5/oEvaZDvNdUg=; b=XaUGE2OkSxWb/YW0D7gfFZO2Zd4PkrIIUBYpIUraZKAZw/6tO/oGu5UuxxzJrRckFN JYd6fRd72QbKdxzBANak3O6RjfAbd68/KigcWRIoZWu0UJHRW+eYGr1W97ys2a8tgOxw +YUSOChvuIGYxzFN/aJFHL6UhslF+B5ulIrOLtqsbSlE2RBgG/whUd32uOtUyQq5lrJq wogA5DlOoYIJt1YzWU0c9tTp/hBr0x4xxqmyDTzIBR5lZ0+mq4vrqUh3jSMPiZLBQXjn 5K3qdMGNt8Tvewd90rlSAihTDFvv3mp/OsU1OlZamJEoLFFiXNuIim9dD70DFShr5Su8 Y4CA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=5rrzvUkpuCnqMHM9DLoYJ4yP3OmI6m5/oEvaZDvNdUg=; b=SP5/GSdCQ6Ij72PkinGDG3p9Aldq8o6ZLFRMI1iiGwDP6WSdb0uC+2NLyb2/W7PPm2 WDLjfPwlN3KWQ87p4XJfY+FokxPXKC22Dwp7cHImpkv5C0X71T/6h98eNQ7Tx1MmNi8s qpa8ZgiM/eDhr1iR1PsMRmGXmwP+XcoqNerUjw9bFSVoOhRM72G+4p1ec0qTzDIMbLLA dleZ+zwJIelKOMQSGuY9tZgWhVuYlxYFFU1GPpxGSb+tQK0XIX25EITwpPqHaEn2EhkC Qtk2HBLwjJCgud8V9APAjKbQbea2cZDQd4l2hhn8eRCbKJcfPE+urL/38fABo1RzXGLY 0ixw== X-Gm-Message-State: AA+aEWYR3jD1B4qOyjbjeYLZVrh1aCJx/DFcsqLwrITK6VGdrdgGH0O6 zCUyNxE4VLUWLSOCgxRLaD6GvPzB X-Google-Smtp-Source: AFSGD/UdNBF3bobkZgieYmJz4VrnX8gEXTEGqNTY11ZrhDlZtpga2idMbatXhzzVA7cEHBXq+dnKhQ== X-Received: by 2002:a1c:e913:: with SMTP id q19mr6897276wmc.55.1544628249942; Wed, 12 Dec 2018 07:24:09 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:09 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:09 +0100 Message-Id: <1544628195-37728-49-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::336 Subject: [Qemu-devel] [PULL 48/54] vhost-user: support cross-endian vnet headers 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP vhost-user already has a way to communicate the endianness of the guest via the vring endianness messages. The vring endianness always matches the vnet header endianness so there is no need to do anything else in the backend. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-9-git-send-email-pbonzini@redhat.com> --- net/vhost-user.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/net/vhost-user.c b/net/vhost-user.c index a39f9c9..cd9659d 100644 --- a/net/vhost-user.c +++ b/net/vhost-user.c @@ -172,6 +172,17 @@ static void net_vhost_user_cleanup(NetClientState *nc) qemu_purge_queued_packets(nc); } +static int vhost_user_set_vnet_endianness(NetClientState *nc, + bool enable) +{ + /* Nothing to do. If the server supports + * VHOST_USER_PROTOCOL_F_CROSS_ENDIAN, it will get the + * vnet header endianness from there. If it doesn't, negotiation + * fails. + */ + return 0; +} + static bool vhost_user_has_vnet_hdr(NetClientState *nc) { assert(nc->info->type == NET_CLIENT_DRIVER_VHOST_USER); @@ -193,6 +204,8 @@ static NetClientInfo net_vhost_user_info = { .cleanup = net_vhost_user_cleanup, .has_vnet_hdr = vhost_user_has_vnet_hdr, .has_ufo = vhost_user_has_ufo, + .set_vnet_be = vhost_user_set_vnet_endianness, + .set_vnet_le = vhost_user_set_vnet_endianness, }; static gboolean net_vhost_user_watch(GIOChannel *chan, GIOCondition cond, From patchwork Wed Dec 12 15:23:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726655 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 1FF5C15A6 for ; Wed, 12 Dec 2018 16:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EE6328A26 for ; Wed, 12 Dec 2018 16:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 022F82A396; Wed, 12 Dec 2018 16:04:45 +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 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 9165528A26 for ; Wed, 12 Dec 2018 16:04:45 +0000 (UTC) Received: from localhost ([::1]:45775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX707-0001Sy-W8 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:04:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52811) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NA-0001No-3G for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000h3-Bc for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:40079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000ZI-Ux for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wr1-x429.google.com with SMTP id p4so18090179wrt.7 for ; Wed, 12 Dec 2018 07:24:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dy2XBDnlnMctI8rViKSsx2YcTqIYC7mbq+ATX25sGNs=; b=ROEQ0jy3C8h3nw8OxCu4orR0M8z9PKYSv6scuRMjq8sc8ZPSIUDKy7gtAuldCthkOw qyt7/SOQdT7vNRsRtWdvfsKS+VvDs7V/BQkLDIMt6FpN8CDndKwaVkBt1LjcD6iPHwoH pPY0nLgvIcsU1bbuTfu1XjZSee80pFJcsReSqwdN8ue6tuefvzYukHQ4OsWmZmF7Qvbe jUuNYcBfld9NPEYhEL7CIuf22txI6hEb4ujsJXAobjOVFjwnYHP310nqGEmx5hoLMLRd /lsKuDhfZXXpU5uPzOnfAEnVTez7f/sMavFQydYueAC/+3TnTZQIKNYK6teWQht5PEDA I1JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=dy2XBDnlnMctI8rViKSsx2YcTqIYC7mbq+ATX25sGNs=; b=LfjFV/yk4XuakTEuKtOhutG828FbZR0LcxzI+U0t+jAjIMtul/kW7UgjRe6DGuFpNa sri7mll7CD5qNEtpaU3EHdgBYM4SteJszqKP4I1T/LeaZaNk/0UXgB2NEwJm6Msfu2SD 2HOrvE5mdhBkrFG1/LFFBgIWnnMde+W4KyKG6/SbiBpjVmReKq1NnNCIrtvnDGt7rsEZ okdnLItiVTBabSpknMswbEih6lQQ1NK3wK6KNyo7MsezjwDjRNuq4h+8IAZxWqtmJQIU lkEINLZfCn+We2MkjQpPOnh+asoXqhdRlo7jQYYb/OUoYKQqDqm2hVderz3rF5UZ/y7+ Og/g== X-Gm-Message-State: AA+aEWZzYZUu0AMbM/XmqsNWFJQdiShpE2WuQ5CfmiKIMytgD49bJvQw tb1QAB0eQ65nK2NkaF9Y8Y1IwX56 X-Google-Smtp-Source: AFSGD/UN6FZDucR1ZxocE2LZ9hHSAjS0d4YifjHFclfisXdBSPaSXUfnM8jagCXMFhoBC7NYg0OI3A== X-Received: by 2002:a5d:628a:: with SMTP id k10mr17104942wru.254.1544628250876; Wed, 12 Dec 2018 07:24:10 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:10 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:10 +0100 Message-Id: <1544628195-37728-50-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::429 Subject: [Qemu-devel] [PULL 49/54] vhost-user-test: support VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will be useful to run the qtest for ppc64 targets on (for example) x86_64 hosts. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-Id: <1543851204-41186-10-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 6a805e6..82fc6c5 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -51,6 +51,7 @@ #define VHOST_USER_F_PROTOCOL_FEATURES 30 #define VHOST_USER_PROTOCOL_F_MQ 0 #define VHOST_USER_PROTOCOL_F_LOG_SHMFD 1 +#define VHOST_USER_PROTOCOL_F_CROSS_ENDIAN 6 #define VHOST_LOG_PAGE 0x1000 @@ -251,7 +252,7 @@ static void wait_for_fds(TestServer *s) static void read_guest_mem_server(TestServer *s) { - uint32_t *guest_mem; + uint8_t *guest_mem; int i, j; size_t size; @@ -278,8 +279,8 @@ static void read_guest_mem_server(TestServer *s) g_assert(guest_mem != MAP_FAILED); guest_mem += (s->memory.regions[i].mmap_offset / sizeof(*guest_mem)); - for (j = 0; j < 256; j++) { - uint32_t a = readl(s->memory.regions[i].guest_phys_addr + j*4); + for (j = 0; j < 1024; j++) { + uint32_t a = readb(s->memory.regions[i].guest_phys_addr + j); uint32_t b = guest_mem[j]; g_assert_cmpint(a, ==, b); @@ -367,6 +368,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) msg.flags |= VHOST_USER_REPLY_MASK; msg.size = sizeof(m.payload.u64); msg.payload.u64 = 1 << VHOST_USER_PROTOCOL_F_LOG_SHMFD; + msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_CROSS_ENDIAN; if (s->queues > 1) { msg.payload.u64 |= 1 << VHOST_USER_PROTOCOL_F_MQ; } From patchwork Wed Dec 12 15:23:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726635 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 0AD8B6C5 for ; Wed, 12 Dec 2018 15:55:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EE46E2B20E for ; Wed, 12 Dec 2018 15:55:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E263D2B3A6; Wed, 12 Dec 2018 15:55:08 +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 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 629B62B20E for ; Wed, 12 Dec 2018 15:55:08 +0000 (UTC) Received: from localhost ([::1]:45726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6qp-00024B-LO for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:55:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52737) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NJ-9T for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N3-0000eF-6S for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:33946) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N1-0000Zl-1f for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:21 -0500 Received: by mail-wm1-x335.google.com with SMTP id y185so11705808wmd.1 for ; Wed, 12 Dec 2018 07:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=B9VhKO2W9JIF/PCxT0Z34NpXqfmEufxNf9w/zUS6xC0=; b=ih+4ESy5Zc1dNtpevI8jAHerTzP63S2kKrHrz38Qp8lAygiCYbRCcbvcfQMeEaxxKd 7YHb4jkXjeetwxAt1+HzBqCwxZGIfHbxctf1l8TXZtoALmWII6gYbEmOYvJHTQfjBj2F Fcb3R780OrjW9uf0a1y0eTNHysufPebfbiZbMMP9Pxr6/va/LLxtfqlOghlLyHAtdPeR EikHcIJg0u/KRTaoMnRV0O4vGNlO2KQe2a1KLxE2CfWi17oD5ABLjkLsq8QtW5uFt38H JobEZQP1yyJPh6oA8OFPdvNGOETs9HWVVQwOwDdjDyPrL0HjgnWJOBM1wIaZLipwhDav RfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=B9VhKO2W9JIF/PCxT0Z34NpXqfmEufxNf9w/zUS6xC0=; b=LyK+DfJZS0LG+WtHB9pbygM/sBdA54Gk89vLa4/uxYn9oozkCkOPMNcQoOXXgLVJNy wrmzYPH/cP7Sh0mhfdp9EVGjiFjAd/fDW8zIGUNw/cQfALtH7q2GbI8k9UleHeVLFO4P +sRwWT1Emxyz6EX1JeVfWdbJOqjCjvGV5dDAMb41xjx9GPmvIPcrOT9qc7liRwgQmpFQ Bbj4VXBqBvL+5SunQwQXk8sZuyD+/6lQW8YRTCK5hA8PZDCAmJ+Dv+Jb9t3DS5oewWA8 0ggL1PGy/aweLb270JCkEtrX6mHBHe9tVwAa5JpDawzGOrlujGTjDEKiL2fkUYVKd2pe 1zEQ== X-Gm-Message-State: AA+aEWb96vJeG+Rq0iicqGn8cxUZQinKc8TDVJ2HOmdiTgj35TBDDkQl tV4TVp9eOeE0V9lzHtt6IjAIyMAJ X-Google-Smtp-Source: AFSGD/WX9r94uV1AkrBV1/n/nrgB6DJR3UHul8c/aJdJt12325Kuf2hYH8mhr770qRLreWuFltRbSA== X-Received: by 2002:a1c:7fca:: with SMTP id a193mr6758601wmd.36.1544628251837; Wed, 12 Dec 2018 07:24:11 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:11 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:11 +0100 Message-Id: <1544628195-37728-51-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::335 Subject: [Qemu-devel] [PULL 50/54] vhost-user-test: skip if there is no memory at address 0 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The virt machine cannot run the vhost-user qtests because they hardcode the presence of memory at address 0. Report the tests as a skip so that they can be converted to use qgraph. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-11-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 58 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 82fc6c5..59e1aec 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -228,9 +228,11 @@ static void uninit_virtio_dev(TestServer *s) qvirtio_pci_device_free(s->dev); } -static void wait_for_fds(TestServer *s) +static bool wait_for_fds(TestServer *s) { gint64 end_time; + bool got_region; + int i; g_mutex_lock(&s->data_mutex); @@ -248,6 +250,19 @@ static void wait_for_fds(TestServer *s) g_assert_cmpint(s->fds_num, ==, s->memory.nregions); g_mutex_unlock(&s->data_mutex); + + got_region = false; + for (i = 0; i < s->memory.nregions; ++i) { + VhostUserMemoryRegion *reg = &s->memory.regions[i]; + if (reg->guest_phys_addr == 0) { + got_region = true; + break; + } + } + if (!got_region) { + g_test_skip("No memory at address 0x0"); + } + return got_region; } static void read_guest_mem_server(TestServer *s) @@ -256,8 +271,6 @@ static void read_guest_mem_server(TestServer *s) int i, j; size_t size; - wait_for_fds(s); - g_mutex_lock(&s->data_mutex); /* iterate all regions */ @@ -577,8 +590,6 @@ static void write_guest_mem(TestServer *s, uint32_t seed) int i, j; size_t size; - wait_for_fds(s); - /* iterate all regions */ for (i = 0; i < s->fds_num; i++) { @@ -661,8 +672,13 @@ static void test_read_guest_mem(const void *arg) init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC); + if (!wait_for_fds(server)) { + goto exit; + } + read_guest_mem_server(server); +exit: uninit_virtio_dev(server); qtest_quit(s); @@ -689,8 +705,10 @@ static void test_migrate(void) g_free(cmd); init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + size = get_log_size(s); g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)); @@ -699,6 +717,7 @@ static void test_migrate(void) g_free(tmp); to = qtest_init(cmd); g_free(cmd); + init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); source = g_source_new(&test_migrate_source_funcs, sizeof(TestMigrateSource)); @@ -738,15 +757,18 @@ static void test_migrate(void) global_qtest = to; qmp_eventwait("RESUME"); + g_assert(wait_for_fds(s)); read_guest_mem_server(dest); - uninit_virtio_dev(s); uninit_virtio_dev(dest); + qtest_quit(to); g_source_destroy(source); g_source_unref(source); - qtest_quit(to); +exit: + uninit_virtio_dev(s); + test_server_free(dest); qtest_quit(from); test_server_free(s); @@ -810,16 +832,20 @@ static void test_reconnect_subprocess(void) g_free(cmd); init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } + wait_for_rings_started(s, 2); /* reconnect */ s->fds_num = 0; s->rings = 0; g_idle_add(reconnect_cb, s); - wait_for_fds(s); + g_assert(wait_for_fds(s)); wait_for_rings_started(s, 2); +exit: uninit_virtio_dev(s); qtest_end(); @@ -848,9 +874,12 @@ static void test_connect_fail_subprocess(void) g_free(cmd); init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); +exit: uninit_virtio_dev(s); qtest_end(); @@ -878,9 +907,12 @@ static void test_flags_mismatch_subprocess(void) g_free(cmd); init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); - wait_for_fds(s); + if (!wait_for_fds(s)) { + goto exit; + } wait_for_rings_started(s, 2); +exit: uninit_virtio_dev(s); qtest_end(); From patchwork Wed Dec 12 15:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726671 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 5333015A6 for ; Wed, 12 Dec 2018 16:11:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3CECA2B752 for ; Wed, 12 Dec 2018 16:11:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 310472B15D; Wed, 12 Dec 2018 16:11:30 +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 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 772E92B5A5 for ; Wed, 12 Dec 2018 16:11:29 +0000 (UTC) Received: from localhost ([::1]:45821 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX76e-00071Z-4f for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:11:28 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NA-0001Op-O3 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000hT-Ix for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:55389) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N6-0000a7-9w for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wm1-x329.google.com with SMTP id y139so6134870wmc.5 for ; Wed, 12 Dec 2018 07:24:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yvkc5NIGJX1pctmpH7dLVW+FoWM6jiDssoit3CaEET0=; b=cK/l+HINSAABe9+dS9MhEKXfCaZPkSZ/FZs4aZkU1GWhqsBujd1Hp/ggw3XxJmjeSa HH2txHPgIgOwzsT2Z3iaiJJxADFn1bKKjlnAMPQF/wYCiF5SMZHrdzR41lZiTuDHZ+S6 LDyzcTiOrHHewE1KqYW0JEvA1EbOdhwMJamv6Sn8LIGMK2kvf1S4Sz3dK6WrduTxG5BY DSYeSXRgMyASAgFQ62ew40vEQrPHuYzEfLSp7L9YcCVBKWXYm3PgmF9YCFEe2OICGU25 2MunqKDeks6+NpjXy72lTi/WHwStTha7ZpTPhRz8OJS8XlSYMCwGQqToen3xEtTxJg+7 G0Sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=yvkc5NIGJX1pctmpH7dLVW+FoWM6jiDssoit3CaEET0=; b=lhaRwxdHYuXo4kYFGdBkcZhtoXSCTLIJZhghEPDfFnaqq1iz5RC87XtRF8wmxq9fc0 6zfP4ABaRFPYJ2Wwm/dyUSLVU9ryex6SCMGqX7uGn/t30Wh6psx4vWvs4saqWvtHdJC7 wrY6aW4TFkhAHTjKZG27KhT81XLMSlGG3g1NN10IjNceVVb5z8jBNQ4IqIrHE4EF809C ZlHbfj4Gmb0jJyJS/v459fpqQ8cTzZazJwncZBeveuSzYsjD6+Uvue0vxzmcBnEz0Fn6 q41ehvNrgIpEE8avIcl3DMIauhGkVgotJ6ps+QwzH5kwM2oE5E4IQuPjTWQGkmFmOSze cj9Q== X-Gm-Message-State: AA+aEWY90bAdvvn48mNi8StJ115sC+TfqVkyueVNyGFa6X77QhtPqKz1 OyhJC1JD3cnYMuJWeOS0UgBhS9L0 X-Google-Smtp-Source: AFSGD/XPYo7kRS5pucvUO7/na9p5YW6Vb+Rgp4vQ71B/w1VfW41ZTNB/Q7if0PWl0q/C0KPRfqTjLg== X-Received: by 2002:a7b:c397:: with SMTP id s23mr4620091wmj.127.1544628252500; Wed, 12 Dec 2018 07:24:12 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:12 +0100 Message-Id: <1544628195-37728-52-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::329 Subject: [Qemu-devel] [PULL 51/54] vhost-user-test: reduce usage of global_qtest 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Whenever the code can run on multiple QTestStates, use them explicitly instead of global_qtest. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Reviewed-by: Thomas Huth Message-Id: <1543851204-41186-12-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 59e1aec..c3a8af3 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -187,12 +187,12 @@ static char *get_qemu_cmd(TestServer *s, } } -static void init_virtio_dev(TestServer *s, uint32_t features_mask) +static void init_virtio_dev(QTestState *qts, TestServer *s, uint32_t features_mask) { uint32_t features; int i; - s->bus = qpci_init_pc(global_qtest, NULL); + s->bus = qpci_init_pc(qts, NULL); g_assert_nonnull(s->bus); s->dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET); @@ -203,7 +203,7 @@ static void init_virtio_dev(TestServer *s, uint32_t features_mask) qvirtio_set_acknowledge(&s->dev->vdev); qvirtio_set_driver(&s->dev->vdev); - s->alloc = pc_alloc_init(global_qtest); + s->alloc = pc_alloc_init(qts); for (i = 0; i < s->queues * 2; i++) { s->vq[i] = qvirtqueue_setup(&s->dev->vdev, s->alloc, i); @@ -265,7 +265,7 @@ static bool wait_for_fds(TestServer *s) return got_region; } -static void read_guest_mem_server(TestServer *s) +static void read_guest_mem_server(QTestState *qts, TestServer *s) { uint8_t *guest_mem; int i, j; @@ -293,7 +293,7 @@ static void read_guest_mem_server(TestServer *s) guest_mem += (s->memory.regions[i].mmap_offset / sizeof(*guest_mem)); for (j = 0; j < 1024; j++) { - uint32_t a = readb(s->memory.regions[i].guest_phys_addr + j); + uint32_t a = qtest_readb(qts, s->memory.regions[i].guest_phys_addr + j); uint32_t b = guest_mem[j]; g_assert_cmpint(a, ==, b); @@ -670,13 +670,13 @@ static void test_read_guest_mem(const void *arg) s = qtest_start(qemu_cmd); g_free(qemu_cmd); - init_virtio_dev(server, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, server, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(server)) { goto exit; } - read_guest_mem_server(server); + read_guest_mem_server(global_qtest, server); exit: uninit_virtio_dev(server); @@ -690,7 +690,7 @@ static void test_migrate(void) TestServer *s = test_server_new("src"); TestServer *dest = test_server_new("dest"); char *uri = g_strdup_printf("%s%s", "unix:", dest->mig_path); - QTestState *global = global_qtest, *from, *to; + QTestState *from, *to; GSource *source; gchar *cmd, *tmp; QDict *rsp; @@ -704,7 +704,7 @@ static void test_migrate(void) from = qtest_start(cmd); g_free(cmd); - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(from, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -717,7 +717,7 @@ static void test_migrate(void) g_free(tmp); to = qtest_init(cmd); g_free(cmd); - init_virtio_dev(dest, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(to, dest, 1u << VIRTIO_NET_F_MAC); source = g_source_new(&test_migrate_source_funcs, sizeof(TestMigrateSource)); @@ -753,12 +753,10 @@ static void test_migrate(void) qobject_unref(rsp); qmp_eventwait("STOP"); + qtest_qmp_eventwait(to, "RESUME"); - global_qtest = to; - qmp_eventwait("RESUME"); - - g_assert(wait_for_fds(s)); - read_guest_mem_server(dest); + g_assert(wait_for_fds(dest)); + read_guest_mem_server(to, dest); uninit_virtio_dev(dest); qtest_quit(to); @@ -773,8 +771,6 @@ exit: qtest_quit(from); test_server_free(s); g_free(uri); - - global_qtest = global; } static void wait_for_rings_started(TestServer *s, size_t count) @@ -831,7 +827,7 @@ static void test_reconnect_subprocess(void) qtest_start(cmd); g_free(cmd); - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -873,7 +869,7 @@ static void test_connect_fail_subprocess(void) qtest_start(cmd); g_free(cmd); - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -906,7 +902,7 @@ static void test_flags_mismatch_subprocess(void) qtest_start(cmd); g_free(cmd); - init_virtio_dev(s, 1u << VIRTIO_NET_F_MAC); + init_virtio_dev(global_qtest, s, 1u << VIRTIO_NET_F_MAC); if (!wait_for_fds(s)) { goto exit; } @@ -957,7 +953,7 @@ static void test_multiqueue(void) qtest_start(cmd); g_free(cmd); - init_virtio_dev(s, features_mask); + init_virtio_dev(global_qtest, s, features_mask); wait_for_rings_started(s, s->queues * 2); From patchwork Wed Dec 12 15:23:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726659 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 3BDDE174F for ; Wed, 12 Dec 2018 16:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2ABB92A396 for ; Wed, 12 Dec 2018 16:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F1212B1BB; Wed, 12 Dec 2018 16:05:45 +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 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 AF0A42A396 for ; Wed, 12 Dec 2018 16:05:44 +0000 (UTC) Received: from localhost ([::1]:45782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX716-0002Dk-0I for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:05:44 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NI-9Y for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000g1-MP for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:36450) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000b2-AP for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x433.google.com with SMTP id u3so18122909wrs.3 for ; Wed, 12 Dec 2018 07:24:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=M+jt69yDIpdYBX90OpyDPxTjda60t17pNUwWe+3P17M=; b=GwpO7oE4VBYA7/bY1QMi2VJtouOO0TQ21U0D6NBjK6h3+i7RNO1XMetF0DSwfhksXP jmedTWvii3S2Ecbiv/P3/x7IFWvEK8jMJqOnSYXDa2Cg6Ze2CkHWtTG6EksfloSCJSm8 frbbjsbu3Hby0c4OjtweYum58oMVUL6N9hXpAorRKutHtWQFNXGmFZegezENox4PajpQ aOmR45L9BBC92rY+0cDR+cfNcBBbZwNV6L9FLV0T4oRvRAWk0udNT7MaX1sX7gJT+uxy gLbH/zchbtWr+DubUuj9ElPxGyBS2uofdtbnD4xQ3qsgtkevb+TuDlKmie7pnKMnkIY4 ND7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=M+jt69yDIpdYBX90OpyDPxTjda60t17pNUwWe+3P17M=; b=V7D9iW0Qr3pVcrUypzKcsnu82aMyRjTW4Y/um1OoVf1IA81+sr9lARc8741BhfwNMA ecPb1S5CMqTTI7oYaw5OXeeimZpQ47uOeGLoek22jNpRgdcHCLI5vTMXNoanZ7vhRfGn x6utIaGv9Ax3CUj/+SzEoOw7XbPv7NnTCfRe/JKUBIOVj3CmT3BPNn4Y4czVxwKVwOMr GyfMDRO78WaQZrcF3xAdf3XKOHOPaNLY4vCZeDf17ix1DH3LlXmmVBo+Tvhm3LveiQVv UPBsCabZwcNBEonAjrGsF3L430jYkOzevBudWOMYeIdhETnmrLJbGAxOfP5A8YQkDGSt mnCw== X-Gm-Message-State: AA+aEWbPKkOipn2Q1DJDm34mMXztLlfjg5aWfjAjSNrIKNyNbXiPcBhw N7hNaLHJgIyxG0urbK68Q4JSqf4X X-Google-Smtp-Source: AFSGD/XHlCI+Nsu/5SQDP9nrWyNaPT5VV6s7fhDf5wNYN6ehvXMoyU6cEF/Y7ESBNNsp7RrAqah7+g== X-Received: by 2002:adf:9382:: with SMTP id 2mr17327363wrp.269.1544628254063; Wed, 12 Dec 2018 07:24:14 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:12 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:13 +0100 Message-Id: <1544628195-37728-53-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 Subject: [Qemu-devel] [PULL 52/54] vhost-user-test: create a main loop per TestServer 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This makes the tests more independent and removes the need to defer test_server_free via an idle event source. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-13-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index c3a8af3..2e610d4 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -143,6 +143,8 @@ typedef struct TestServer { int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; VhostUserMemory memory; + GMainLoop *loop; + GThread *thread; GMutex data_mutex; GCond data_cond; int log_fd; @@ -490,6 +492,10 @@ static TestServer *test_server_new(const gchar *name) { TestServer *server = g_new0(TestServer, 1); + server->loop = g_main_loop_new(NULL, FALSE); + /* run the main loop thread so the chardev may operate */ + server->thread = g_thread_new(NULL, thread_function, server->loop); + server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name); server->mig_path = g_strdup_printf("%s/%s.mig", tmpfs, name); server->chr_name = g_strdup_printf("chr-%s", name); @@ -533,9 +539,18 @@ static void test_server_listen(TestServer *server) test_server_create_chr(server, ",server,nowait"); } -static gboolean _test_server_free(TestServer *server) +static void test_server_free(TestServer *server) { int i; + int ret; + + /* finish the helper thread and dispatch pending sources */ + g_main_loop_quit(server->loop); + g_thread_join(server->thread); + while (g_main_context_pending(NULL)) { + g_main_context_iteration(NULL, TRUE); + } + g_main_loop_unref(server->loop); qemu_chr_fe_deinit(&server->chr, true); @@ -558,13 +573,6 @@ static gboolean _test_server_free(TestServer *server) qpci_free_pc(server->bus); g_free(server); - - return FALSE; -} - -static void test_server_free(TestServer *server) -{ - g_idle_add((GSourceFunc)_test_server_free, server); } static void wait_for_log_fd(TestServer *s) @@ -969,8 +977,6 @@ int main(int argc, char **argv) const char *hugefs; int ret; char template[] = "/tmp/vhost-test-XXXXXX"; - GMainLoop *loop; - GThread *thread; g_test_init(&argc, &argv, NULL); @@ -991,10 +997,6 @@ int main(int argc, char **argv) root = tmpfs; } - loop = g_main_loop_new(NULL, FALSE); - /* run the main loop thread so the chardev may operate */ - thread = g_thread_new(NULL, thread_function, loop); - if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES), @@ -1022,14 +1024,6 @@ int main(int argc, char **argv) /* cleanup */ - /* finish the helper thread and dispatch pending sources */ - g_main_loop_quit(loop); - g_thread_join(thread); - while (g_main_context_pending(NULL)) { - g_main_context_iteration (NULL, TRUE); - } - g_main_loop_unref(loop); - ret = rmdir(tmpfs); if (ret != 0) { g_test_message("unable to rmdir: path (%s): %s\n", From patchwork Wed Dec 12 15:23:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726669 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 CEC5F16B1 for ; Wed, 12 Dec 2018 16:08:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFA529A7D for ; Wed, 12 Dec 2018 16:08:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1CE4227165; Wed, 12 Dec 2018 16:08:37 +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 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 A7DA52B203 for ; Wed, 12 Dec 2018 16:08:36 +0000 (UTC) Received: from localhost ([::1]:45789 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX73r-0003PM-Q5 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 11:08:35 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52817) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6NA-0001Nu-4n for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N6-0000gx-8B for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:28 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:53236) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000bq-S4 for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:24 -0500 Received: by mail-wm1-x32d.google.com with SMTP id m1so5560018wml.2 for ; Wed, 12 Dec 2018 07:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/r3irPmeT/Dx8CtevopC7eCNjCmc0UwQ5+AMiup/K1g=; b=SzyvtyLpJm1BG69HZipP73CtPSIuh2d3gvCtNduxNyEUMOWlhn9yAuMVULXmb+1ElA Pcyl5+EFv+SCFjW7BG2tiPaKBH2pCkXXHwg8Sd4Tg4TiUkAYKxvR1JwIbFkoy0nq7qzt B4blAzzEBnC14DmE09ntPbsdkAEHFXD9oBCXzSd0YIhsgOx73PSy+2wfUPtLlUWtpOLY eYAW9NGEx865qI6ydeRzX87GteZ7qy0OLZyPG9IbsN3sr6VtfzgPHmfprocvWEjpl42c EEfLaKNfQYL+1WtGdL+EwNjeO2gce8SeIEBxgmGS8xuWaPK1chQ6Wdnm9uRI6/crD6l3 V5zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/r3irPmeT/Dx8CtevopC7eCNjCmc0UwQ5+AMiup/K1g=; b=oILBXQ57l4p9MibOFCDIND+5dlV7Qt0OPX++gse038g8uhpkc08G1nWFTgWxV5/V87 hrZYwuJy6XypGptoMiPGyt1DAm6t/Y94ucO/qb+h3LJiehuIZxB8n5JKvrx/Xc9tNghF ac1U9W0E134KkM6CbWApWKgnUHRi7Snda2flMBVHBW8PiVX71vMntfE5TCaOW+9GOin6 /5wJ6g9giu4ghq6MNfwaAH7Izuq2tL+uPpR/7Os/X0EHds1sCkBAgdxy0Z1bSVzBMHkY kUqfLNuteSxsFkYEROwEI1fPLcmKcpwbAZ0QBK+RaQ0vl28VWKUvmPzut8VCfL4To6Ut knTQ== X-Gm-Message-State: AA+aEWadNuLLfnJjrzg2Y7lXI0RKiIqYQ/i0KLfvzPI31VcYZfLMIke6 7Zfoir+aL7jNzE1lxT0RBk7YpcwM X-Google-Smtp-Source: AFSGD/WeZWn99awBKqcSIPs9kPtD/i2VM4HFWly3mNe02JmvWpAapifDo0lOZDP4MqDAYnz5MB8P6w== X-Received: by 2002:a7b:c315:: with SMTP id k21mr6509125wmj.145.1544628255636; Wed, 12 Dec 2018 07:24:15 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.14 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:14 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:14 +0100 Message-Id: <1544628195-37728-54-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::32d Subject: [Qemu-devel] [PULL 53/54] vhost-user-test: small changes to init_hugepagefs 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP After the conversion to qgraph, the equivalent of "main" will be in a constructor and will run even if the tests are not being requested. Therefore, it should not assert that init_hugepagefs succeeds and will be called when creating the TestServer. This patch changes the prototype of init_hugepagefs, this way the next patch looks nicer. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-14-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 2e610d4..4e4765b 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -461,13 +461,19 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) g_mutex_unlock(&s->data_mutex); } -static const char *init_hugepagefs(const char *path) +static const char *init_hugepagefs(void) { + const char *path = getenv("QTEST_HUGETLBFS_PATH"); struct statfs fs; int ret; + if (!path) { + return NULL; + } + if (access(path, R_OK | W_OK | X_OK)) { g_test_message("access on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } @@ -477,11 +483,13 @@ static const char *init_hugepagefs(const char *path) if (ret != 0) { g_test_message("statfs on path (%s): %s\n", path, strerror(errno)); + abort(); return NULL; } if (fs.f_type != HUGETLBFS_MAGIC) { g_test_message("Warning: path not on HugeTLBFS: %s\n", path); + abort(); return NULL; } @@ -974,7 +982,6 @@ static void test_multiqueue(void) int main(int argc, char **argv) { - const char *hugefs; int ret; char template[] = "/tmp/vhost-test-XXXXXX"; @@ -989,13 +996,7 @@ int main(int argc, char **argv) } g_assert(tmpfs); - hugefs = getenv("QTEST_HUGETLBFS_PATH"); - if (hugefs) { - root = init_hugepagefs(hugefs); - g_assert(root); - } else { - root = tmpfs; - } + root = init_hugepagefs() ? : tmpfs; if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", From patchwork Wed Dec 12 15:23:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 10726643 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 77A806C5 for ; Wed, 12 Dec 2018 15:58:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 675072B2FB for ; Wed, 12 Dec 2018 15:58:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5BB112B3A6; Wed, 12 Dec 2018 15:58:18 +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 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 B4BD42B2FB for ; Wed, 12 Dec 2018 15:58:17 +0000 (UTC) Received: from localhost ([::1]:45735 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6tt-0003JZ-0j for patchwork-qemu-devel@patchwork.kernel.org; Wed, 12 Dec 2018 10:58:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52729) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gX6N8-0001NC-8v for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gX6N5-0000gD-PM for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:26 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:39688) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gX6N5-0000cP-CM for qemu-devel@nongnu.org; Wed, 12 Dec 2018 10:24:23 -0500 Received: by mail-wr1-x431.google.com with SMTP id t27so18089326wra.6 for ; Wed, 12 Dec 2018 07:24:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SdDfzS1IgKl8cuiEQWhOVQGYmNxk5jB3jqmhqTuTvug=; b=ZmuvLwWJddtR5zk58z2uP0Z7NOxk7G7rMz2ei4ea0JE71RjlUanaIOmXHXhO09+Ifl ZSH6A3hXD3dSkVN9t6dvmH/iWNU6Q5kv37FUCnVZFI0nYlYMib/AZ67eXIJwxVhkDbK4 Ap8G+qV6OIHL0sB9VIfOBvufXRx7ZO+ZbBt0km/I67TD7/kcfuNSM6zQ3DSnvcTOR2B3 Q4Fs8EzXXkxyckGSPvIZOawpoMWwOWmSVBjPfprE458Ams7adbllsnjXdwA3XsRo3jjx cLbIUPa7dZN6vBcKs9s5dO9KGswponCDpe37/+2jggmYAl77nqXAL81Qa9gz5dqD4zc4 Hnxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=SdDfzS1IgKl8cuiEQWhOVQGYmNxk5jB3jqmhqTuTvug=; b=oaXylNuSUZmvetyuaQ+kLoNG31YNmIt+6AlqV520XYEneSjI3F2vKT0lK1RP/aTvEB gb/9m1dtyHlDLpWtf+2WLk6gODFHQ6nnjWCUzwAv55h5CpzELXGHI8vrxplYUT6gd5bd JlRFlpu26XvD7ZZhhNWPuUFc8Bwc++0oAjjO+sViU+ogFW/YSMLD/zZW5mJQh+kLl75w HfmTdt4l02fdFb1m6/qnAELlHzF5EC1suFD8Df6KCtUWymA0d2WSceKuxkK9nvDLmgyw /lHcC1gLonmRYdfOlaD/GPvv0Vid73jGwnOXc0Yqa+Wf4WM1bJHZsyOigF7QcZDGb+oM s8CQ== X-Gm-Message-State: AA+aEWaFgE+Q/AxcpPB0icXwyq4brpYun5Bus0LEE/9fHhmZ2iAKX6tU QPrVXkyWFmCPaLzPMDwkxJtFTPs/ X-Google-Smtp-Source: AFSGD/XcuRgyQGnAAmV9w5yDAxU5pnubKVrdBgSp3vLz2i7WLKkALH3yAVjKylZEz7EyZHXmwjsU/w== X-Received: by 2002:adf:91c3:: with SMTP id 61mr16981346wri.324.1544628256669; Wed, 12 Dec 2018 07:24:16 -0800 (PST) Received: from 640k.lan ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id u10sm15878859wrr.33.2018.12.12.07.24.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Dec 2018 07:24:15 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Dec 2018 16:23:15 +0100 Message-Id: <1544628195-37728-55-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> References: <1544628195-37728-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::431 Subject: [Qemu-devel] [PULL 54/54] vhost-user-test: create a temporary directory per TestServer 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: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This makes the tests more independent, and also the source and destination TestServers in the migration test. Reviewed-by: Marc-André Lureau Signed-off-by: Paolo Bonzini Message-Id: <1543851204-41186-15-git-send-email-pbonzini@redhat.com> --- tests/vhost-user-test.c | 75 ++++++++++++++++++++++--------------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 4e4765b..9d7b0d4 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -139,6 +139,8 @@ typedef struct TestServer { gchar *socket_path; gchar *mig_path; gchar *chr_name; + const gchar *mem_path; + gchar *tmpfs; CharBackend chr; int fds_num; int fds[VHOST_MEMORY_MAX_NREGIONS]; @@ -159,9 +161,6 @@ static TestServer *test_server_new(const gchar *name); static void test_server_free(TestServer *server); static void test_server_listen(TestServer *server); -static const char *tmpfs; -static const char *root; - enum test_memfd { TEST_MEMFD_AUTO, TEST_MEMFD_YES, @@ -169,7 +168,7 @@ enum test_memfd { }; static char *get_qemu_cmd(TestServer *s, - int mem, enum test_memfd memfd, const char *mem_path, + int mem, enum test_memfd memfd, const char *chr_opts, const char *extra) { if (memfd == TEST_MEMFD_AUTO && qemu_memfd_check(0)) { @@ -184,7 +183,7 @@ static char *get_qemu_cmd(TestServer *s, } else { return g_strdup_printf(QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV QEMU_CMD_NET "%s", mem, mem, - mem_path, s->chr_name, s->socket_path, + s->mem_path, s->chr_name, s->socket_path, chr_opts, s->chr_name, extra); } } @@ -499,11 +498,21 @@ static const char *init_hugepagefs(void) static TestServer *test_server_new(const gchar *name) { TestServer *server = g_new0(TestServer, 1); + char template[] = "/tmp/vhost-test-XXXXXX"; + const char *tmpfs; server->loop = g_main_loop_new(NULL, FALSE); /* run the main loop thread so the chardev may operate */ server->thread = g_thread_new(NULL, thread_function, server->loop); + tmpfs = mkdtemp(template); + if (!tmpfs) { + g_test_message("mkdtemp on path (%s): %s", template, strerror(errno)); + } + g_assert(tmpfs); + + server->tmpfs = g_strdup(tmpfs); + server->mem_path = init_hugepagefs() ? : server->tmpfs; server->socket_path = g_strdup_printf("%s/%s.sock", tmpfs, name); server->mig_path = g_strdup_printf("%s/%s.mig", tmpfs, name); server->chr_name = g_strdup_printf("chr-%s", name); @@ -560,6 +569,18 @@ static void test_server_free(TestServer *server) } g_main_loop_unref(server->loop); + unlink(server->socket_path); + g_free(server->socket_path); + + unlink(server->mig_path); + g_free(server->mig_path); + + ret = rmdir(server->tmpfs); + if (ret != 0) { + g_test_message("unable to rmdir: path (%s): %s", + server->tmpfs, strerror(errno)); + } + qemu_chr_fe_deinit(&server->chr, true); for (i = 0; i < server->fds_num; i++) { @@ -570,12 +591,6 @@ static void test_server_free(TestServer *server) close(server->log_fd); } - unlink(server->socket_path); - g_free(server->socket_path); - - unlink(server->mig_path); - g_free(server->mig_path); - g_free(server->chr_name); g_assert(server->bus); qpci_free_pc(server->bus); @@ -681,7 +696,7 @@ static void test_read_guest_mem(const void *arg) "read-guest-memfd" : "read-guest-mem"); test_server_listen(server); - qemu_cmd = get_qemu_cmd(server, 512, memfd, root, "", ""); + qemu_cmd = get_qemu_cmd(server, 512, memfd, "", ""); s = qtest_start(qemu_cmd); g_free(qemu_cmd); @@ -716,7 +731,7 @@ static void test_migrate(void) test_server_listen(s); test_server_listen(dest); - cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, "", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, "", ""); from = qtest_start(cmd); g_free(cmd); @@ -729,7 +744,7 @@ static void test_migrate(void) g_assert_cmpint(size, ==, (2 * 1024 * 1024) / (VHOST_LOG_PAGE * 8)); tmp = g_strdup_printf(" -incoming %s", uri); - cmd = get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, root, "", tmp); + cmd = get_qemu_cmd(dest, 2, TEST_MEMFD_AUTO, "", tmp); g_free(tmp); to = qtest_init(cmd); g_free(cmd); @@ -839,7 +854,7 @@ static void test_reconnect_subprocess(void) char *cmd; g_thread_new("connect", connect_thread, s); - cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -881,7 +896,7 @@ static void test_connect_fail_subprocess(void) s->test_fail = true; g_thread_new("connect", connect_thread, s); - cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -914,7 +929,7 @@ static void test_flags_mismatch_subprocess(void) s->test_flags = TEST_FLAGS_DISCONNECT; g_thread_new("connect", connect_thread, s); - cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, root, ",server", ""); + cmd = get_qemu_cmd(s, 2, TEST_MEMFD_AUTO, ",server", ""); qtest_start(cmd); g_free(cmd); @@ -962,7 +977,7 @@ static void test_multiqueue(void) cmd = g_strdup_printf( QEMU_CMD_MEM QEMU_CMD_CHR QEMU_CMD_NETDEV ",queues=%d " "-device virtio-net-pci,netdev=net0,mq=on,vectors=%d", - 512, 512, root, s->chr_name, + 512, 512, s->mem_path, s->chr_name, s->socket_path, "", s->chr_name, s->queues, s->queues * 2 + 2); } @@ -982,22 +997,11 @@ static void test_multiqueue(void) int main(int argc, char **argv) { - int ret; - char template[] = "/tmp/vhost-test-XXXXXX"; - g_test_init(&argc, &argv, NULL); module_call_init(MODULE_INIT_QOM); qemu_add_opts(&qemu_chardev_opts); - tmpfs = mkdtemp(template); - if (!tmpfs) { - g_test_message("mkdtemp on path (%s): %s\n", template, strerror(errno)); - } - g_assert(tmpfs); - - root = init_hugepagefs() ? : tmpfs; - if (qemu_memfd_check(0)) { qtest_add_data_func("/vhost-user/read-guest-mem/memfd", GINT_TO_POINTER(TEST_MEMFD_YES), @@ -1021,16 +1025,5 @@ int main(int argc, char **argv) qtest_add_func("/vhost-user/flags-mismatch", test_flags_mismatch); } - ret = g_test_run(); - - /* cleanup */ - - ret = rmdir(tmpfs); - if (ret != 0) { - g_test_message("unable to rmdir: path (%s): %s\n", - tmpfs, strerror(errno)); - } - g_assert_cmpint(ret, ==, 0); - - return ret; + return g_test_run(); }