From patchwork Tue Nov 17 09:19:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401424 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=caTd1jrk; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0mz1twWz9sRK for ; Tue, 17 Nov 2020 20:21:23 +1100 (AEDT) Received: from localhost ([::1]:42622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kexAv-000517-7b for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:21:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex8n-0001uN-W0 for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:25144) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8l-0006Nd-8V for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604746; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Sut9Fzws5tusu6SI48So6UTIt/7CxEKNGpGPWzrkgbI=; b=caTd1jrkDLHTlxOn6rvln86dD7q8rWNUt3Qpm61H/ea1l0ihwoo7jT974Bp2qt7zEqiHAP /ag7gf5Q+n/RBrPD3SGpMPufZ1glJq/NNLDT7NuIRPtnKc1vY2D9bCdcf6jjKtH0ceBYva CfffuhYQOZW8Jvubf70TRQXm/VY3fTU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-132-X9EbmBuCOtGAX3pgtP1vNw-1; Tue, 17 Nov 2020 04:19:04 -0500 X-MC-Unique: X9EbmBuCOtGAX3pgtP1vNw-1 Received: by mail-wm1-f70.google.com with SMTP id y1so1425805wma.5 for ; Tue, 17 Nov 2020 01:19:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Sut9Fzws5tusu6SI48So6UTIt/7CxEKNGpGPWzrkgbI=; b=K8wweF8gbYBmEY9fcl85a0GzDdMtYam2WhqnkLdW6MzZYICHVBrszX+emaQxxeykrV CQ3E6txvMCExNIcMD5fY80ok4O+A71/GNuMlzOw9uWicqcZbn1ASv+BpXmKA9EtUxhnR FCH6mqvJZrsmhNY1f4t/Oc6byd9ebOx+oKoZgjUwy76yJF2i6a5vWeKxLKzP2g2YGzYd 8tD2UArTHoB/OWQuG1cG6LYCa/p90cR2JshlIXE/YMTk365D3fklrMymrEncXX52RSdk +j4ycEqMrl1naxTLU/Y6uLQGoBw0ShJdRW97Mq2PVzBc8pGdJortueNspH7Ak9hMBISr MgDA== X-Gm-Message-State: AOAM5319ixKpetf0QxyZqWZAd6nJd43WQduwjTPhLpfrOIie36VuEMAM 9axK/n2GkvNHfQe1ox+m7gEQMMmX3ym3B0Memy8mEhLoiISMy8P9pP0u8/QEcPYcQv3IGzzOCaR HoN8VRLRwRM2nyIx/5HY1QeExGN8xmNPxIhlKJVmt9IGdwQlBYg6qmV2vhpWv X-Received: by 2002:a1c:2842:: with SMTP id o63mr3240731wmo.59.1605604742634; Tue, 17 Nov 2020 01:19:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxfaXDI3EETa2d8ZYePsNLWQ/hruIlJ6AZSB7WcJVKIlHUCYAYTwE7kAq174peTipC7ADUGIA== X-Received: by 2002:a1c:2842:: with SMTP id o63mr3240702wmo.59.1605604742388; Tue, 17 Nov 2020 01:19:02 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id a17sm28844427wra.61.2020.11.17.01.19.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:01 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:00 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 1/7] vhost-user: fix VHOST_USER_ADD/REM_MEM_REG truncation Message-ID: <20201117091848.695370-2-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 00:41:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Cornelia Huck , Christian Borntraeger , Stefan Hajnoczi , Raphael Norwitz Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi QEMU currently truncates the mmap_offset field when sending VHOST_USER_ADD_MEM_REG and VHOST_USER_REM_MEM_REG messages. The struct layout looks like this: typedef struct VhostUserMemoryRegion { uint64_t guest_phys_addr; uint64_t memory_size; uint64_t userspace_addr; uint64_t mmap_offset; } VhostUserMemoryRegion; typedef struct VhostUserMemRegMsg { uint32_t padding; /* WARNING: there is a 32-bit hole here! */ VhostUserMemoryRegion region; } VhostUserMemRegMsg; The payload size is calculated as follows when sending the message in hw/virtio/vhost-user.c: msg->hdr.size = sizeof(msg->payload.mem_reg.padding) + sizeof(VhostUserMemoryRegion); This calculation produces an incorrect result of only 36 bytes. sizeof(VhostUserMemRegMsg) is actually 40 bytes. The consequence of this is that the final field, mmap_offset, is truncated. This breaks x86_64 TCG guests on s390 hosts. Other guest/host combinations may get lucky if either of the following holds: 1. The guest memory layout does not need mmap_offset != 0. 2. The host is little-endian and mmap_offset <= 0xffffffff so the truncation has no effect. Fix this by extending the existing 32-bit padding field to 64-bit. Now the padding reflects the actual compiler padding. This can be verified using pahole(1). Also document the layout properly in the vhost-user specification. The vhost-user spec did not document the exact layout. It would be impossible to implement the spec without looking at the QEMU source code. Existing vhost-user frontends and device backends continue to work after this fix has been applied. The only change in the wire protocol is that QEMU now sets hdr.size to 40 instead of 36. If a vhost-user implementation has a hardcoded size check for 36 bytes, then it will fail with new QEMUs. Both QEMU and DPDK/SPDK don't check the exact payload size, so they continue to work. Fixes: f1aeb14b0809e313c74244d838645ed25e85ea63 ("Transmit vhost-user memory regions individually") Cc: Raphael Norwitz Cc: Cornelia Huck Cc: Michael S. Tsirkin Cc: Christian Borntraeger Signed-off-by: Stefan Hajnoczi Message-Id: <20201109174355.1069147-1-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Fixes: f1aeb14b0809 ("Transmit vhost-user memory regions individually") Reviewed-by: Cornelia Huck Reviewed-by: Raphael Norwitz --- contrib/libvhost-user/libvhost-user.h | 2 +- hw/virtio/vhost-user.c | 5 ++--- docs/interop/vhost-user.rst | 21 +++++++++++++++++++-- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.h b/contrib/libvhost-user/libvhost-user.h index a1539dbb69..7d47f1364a 100644 --- a/contrib/libvhost-user/libvhost-user.h +++ b/contrib/libvhost-user/libvhost-user.h @@ -136,7 +136,7 @@ typedef struct VhostUserMemory { } VhostUserMemory; typedef struct VhostUserMemRegMsg { - uint32_t padding; + uint64_t padding; VhostUserMemoryRegion region; } VhostUserMemRegMsg; diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index 9c5b4f7fbc..2fdd5daf74 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -149,7 +149,7 @@ typedef struct VhostUserMemory { } VhostUserMemory; typedef struct VhostUserMemRegMsg { - uint32_t padding; + uint64_t padding; VhostUserMemoryRegion region; } VhostUserMemRegMsg; @@ -800,8 +800,7 @@ static int vhost_user_add_remove_regions(struct vhost_dev *dev, uint64_t shadow_pcb[VHOST_USER_MAX_RAM_SLOTS] = {}; int nr_add_reg, nr_rem_reg; - msg->hdr.size = sizeof(msg->payload.mem_reg.padding) + - sizeof(VhostUserMemoryRegion); + msg->hdr.size = sizeof(msg->payload.mem_reg); /* Find the regions which need to be removed or added. */ scrub_shadow_regions(dev, add_reg, &nr_add_reg, rem_reg, &nr_rem_reg, diff --git a/docs/interop/vhost-user.rst b/docs/interop/vhost-user.rst index 988f154144..6d4025ba6a 100644 --- a/docs/interop/vhost-user.rst +++ b/docs/interop/vhost-user.rst @@ -131,6 +131,23 @@ A region is: :mmap offset: 64-bit offset where region starts in the mapped memory +Single memory region description +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + ++---------+---------------+------+--------------+-------------+ +| padding | guest address | size | user address | mmap offset | ++---------+---------------+------+--------------+-------------+ + +:padding: 64-bit + +:guest address: a 64-bit guest address of the region + +:size: a 64-bit size + +:user address: a 64-bit user address + +:mmap offset: 64-bit offset where region starts in the mapped memory + Log description ^^^^^^^^^^^^^^^ @@ -1281,7 +1298,7 @@ Master message types ``VHOST_USER_ADD_MEM_REG`` :id: 37 :equivalent ioctl: N/A - :slave payload: memory region + :slave payload: single memory region description When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has been successfully negotiated, this message is submitted @@ -1296,7 +1313,7 @@ Master message types ``VHOST_USER_REM_MEM_REG`` :id: 38 :equivalent ioctl: N/A - :slave payload: memory region + :slave payload: single memory region description When the ``VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS`` protocol feature has been successfully negotiated, this message is submitted From patchwork Tue Nov 17 09:19:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401420 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=bS0PzNGz; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0kz1d1Kz9sSs for ; Tue, 17 Nov 2020 20:19:39 +1100 (AEDT) Received: from localhost ([::1]:35212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kex9F-000216-4d for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:19:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45394) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex8p-0001y1-W0 for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:12 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38790) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8n-0006OY-Sr for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604748; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0RnLT5+JMl+oOfkBbmmWTI1h88S6MNDyRCGrZS7inZw=; b=bS0PzNGzEtlLAxFM7TwToXP8Ls/SGPPuHbOunliNvFO4rZVltjiTzgL8A76McQoQa7GSgr JmdAJ48xacJLHIF9PgJPiDGu7n3tQ543HNQkgxaJPXTYHiZhja+FIrZ/YOCwUakipRn6bj Q8QfYOEi0lwYELWmBf7sKANwKqE7eWA= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-256-2mrFOCMEOXWsd4wPBdKnjQ-1; Tue, 17 Nov 2020 04:19:06 -0500 X-MC-Unique: 2mrFOCMEOXWsd4wPBdKnjQ-1 Received: by mail-wr1-f70.google.com with SMTP id v5so12696742wrr.0 for ; Tue, 17 Nov 2020 01:19:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=0RnLT5+JMl+oOfkBbmmWTI1h88S6MNDyRCGrZS7inZw=; b=nlv9thMaHG8APCHHJ+3uQMLE2OlIqtXyoZuDBlxpAAxiswFd8888YpvoYEOx9KjllU bgoc6gJjd3lK8Hgzhyv5uuBNz+dkEiU9UZFpkLMQscqlCX/mWmClxQaAo++j+5J/5DaW UwfjZfbcRpJDTbBMOb+jpoPpLQ2IPcWrdACGQXpp7iaWg6UC+VK+e6arcwrohG8gkQRj 1cXS4WAyBC+/2AvPMNBU2Up6h0NJfGozD81IeZ4eBkm6hG9fKJxqIO13pn9QgItNFHNe LWJV7FwwtkoSaHSQTaM40KsMJ1OoLHyZalQBjNuWB1HSf+PwHi+bmqRw3ZcROeOgEZ/h g1rA== X-Gm-Message-State: AOAM530mIc+oab+jQrJU9ddZ2UktH/0SYSU0vIJnA5lnoia2D5GBPnX9 nm/M8TwWOfDc8WK5P5R05mXNqJqlEUNZdqSXxcmu0ngzh6DbiTKvxA3ncJnqUzU0r9JwSqtIj1w PmXEKeJCjnoCWXyZ5/5cSK041JFim4f1NBSEfmL5V2cwS/XZUvrlUt5UJSH0Z X-Received: by 2002:a1c:9949:: with SMTP id b70mr3286166wme.85.1605604745228; Tue, 17 Nov 2020 01:19:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwx7DteglsDPtOoPBRfIn1LlenLWX9itX2ZK2hwmvEKaHrNQfFRfgZ6wkzcXJH9PDESd6gD4w== X-Received: by 2002:a1c:9949:: with SMTP id b70mr3286145wme.85.1605604744976; Tue, 17 Nov 2020 01:19:04 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id s25sm2570302wmh.16.2020.11.17.01.19.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:04 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:02 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 2/7] meson: move vhost_user_blk_server to meson.build Message-ID: <20201117091848.695370-3-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 00:41:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Peter Maydell , qemu-block@nongnu.org, Max Reitz , Stefan Hajnoczi , Philippe =?utf-8?q?Mathieu-Daud?= =?utf-8?q?=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi The --enable/disable-vhost-user-blk-server options were implemented in ./configure. There has been confusion about them and part of the problem is that the shell syntax used for setting the default value is not easy to read. Move the option over to meson where the conditions are easier to understand: have_vhost_user_blk_server = (targetos == 'linux') if get_option('vhost_user_blk_server').enabled() if targetos != 'linux' error('vhost_user_blk_server requires linux') endif elif get_option('vhost_user_blk_server').disabled() or not have_system have_vhost_user_blk_server = false endif This patch does not change behavior. Signed-off-by: Stefan Hajnoczi Message-Id: <20201110171121.1265142-2-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Tested-by: Philippe Mathieu-Daudé --- meson_options.txt | 2 ++ configure | 16 ++++------------ block/export/meson.build | 5 ++++- meson.build | 12 ++++++++++++ 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index b4f1801875..f6f64785fe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -64,6 +64,8 @@ option('xkbcommon', type : 'feature', value : 'auto', description: 'xkbcommon support') option('virtiofsd', type: 'feature', value: 'auto', description: 'build virtiofs daemon (virtiofsd)') +option('vhost_user_blk_server', type: 'feature', value: 'auto', + description: 'build vhost-user-blk server') option('capstone', type: 'combo', value: 'auto', choices: ['disabled', 'enabled', 'auto', 'system', 'internal'], diff --git a/configure b/configure index 4cef321d9d..516f28a088 100755 --- a/configure +++ b/configure @@ -329,7 +329,7 @@ vhost_crypto="" vhost_scsi="" vhost_vsock="" vhost_user="" -vhost_user_blk_server="" +vhost_user_blk_server="auto" vhost_user_fs="" kvm="auto" hax="auto" @@ -1247,9 +1247,9 @@ for opt do ;; --enable-vhost-vsock) vhost_vsock="yes" ;; - --disable-vhost-user-blk-server) vhost_user_blk_server="no" + --disable-vhost-user-blk-server) vhost_user_blk_server="disabled" ;; - --enable-vhost-user-blk-server) vhost_user_blk_server="yes" + --enable-vhost-user-blk-server) vhost_user_blk_server="enabled" ;; --disable-vhost-user-fs) vhost_user_fs="no" ;; @@ -2390,12 +2390,6 @@ if test "$vhost_net" = ""; then test "$vhost_kernel" = "yes" && vhost_net=yes fi -# libvhost-user is Linux-only -test "$vhost_user_blk_server" = "" && vhost_user_blk_server=$linux -if test "$vhost_user_blk_server" = "yes" && test "$linux" = "no"; then - error_exit "--enable-vhost-user-blk-server is only available on Linux" -fi - ########################################## # pkg-config probe @@ -6289,9 +6283,6 @@ fi if test "$vhost_vdpa" = "yes" ; then echo "CONFIG_VHOST_VDPA=y" >> $config_host_mak fi -if test "$vhost_user_blk_server" = "yes" ; then - echo "CONFIG_VHOST_USER_BLK_SERVER=y" >> $config_host_mak -fi if test "$vhost_user_fs" = "yes" ; then echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak fi @@ -7012,6 +7003,7 @@ NINJA=$ninja $meson setup \ -Dcapstone=$capstone -Dslirp=$slirp -Dfdt=$fdt \ -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\ -Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \ + -Dvhost_user_blk_server=$vhost_user_blk_server \ $cross_arg \ "$PWD" "$source_path" diff --git a/block/export/meson.build b/block/export/meson.build index 19526435d8..135b356775 100644 --- a/block/export/meson.build +++ b/block/export/meson.build @@ -1,2 +1,5 @@ blockdev_ss.add(files('export.c')) -blockdev_ss.add(when: 'CONFIG_VHOST_USER_BLK_SERVER', if_true: files('vhost-user-blk-server.c')) + +if have_vhost_user_blk_server + blockdev_ss.add(files('vhost-user-blk-server.c')) +endif diff --git a/meson.build b/meson.build index b473620321..4b789f18c1 100644 --- a/meson.build +++ b/meson.build @@ -751,6 +751,16 @@ statx_test = ''' has_statx = cc.links(statx_test) +have_vhost_user_blk_server = (targetos == 'linux') + +if get_option('vhost_user_blk_server').enabled() + if targetos != 'linux' + error('vhost_user_blk_server requires linux') + endif +elif get_option('vhost_user_blk_server').disabled() or not have_system + have_vhost_user_blk_server = false +endif + ################# # config-host.h # ################# @@ -775,6 +785,7 @@ config_host_data.set('CONFIG_MPATH_NEW_API', mpathpersist_new_api) config_host_data.set('CONFIG_CURSES', curses.found()) config_host_data.set('CONFIG_SDL', sdl.found()) config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found()) +config_host_data.set('CONFIG_VHOST_USER_BLK_SERVER', have_vhost_user_blk_server) config_host_data.set('CONFIG_VNC', vnc.found()) config_host_data.set('CONFIG_VNC_JPEG', jpeg.found()) config_host_data.set('CONFIG_VNC_PNG', png.found()) @@ -2103,6 +2114,7 @@ summary_info += {'vhost-crypto support': config_host.has_key('CONFIG_VHOST_CRYPT summary_info += {'vhost-scsi support': config_host.has_key('CONFIG_VHOST_SCSI')} summary_info += {'vhost-vsock support': config_host.has_key('CONFIG_VHOST_VSOCK')} summary_info += {'vhost-user support': config_host.has_key('CONFIG_VHOST_KERNEL')} +summary_info += {'vhost-user-blk server support': have_vhost_user_blk_server} summary_info += {'vhost-user-fs support': config_host.has_key('CONFIG_VHOST_USER_FS')} summary_info += {'vhost-vdpa support': config_host.has_key('CONFIG_VHOST_VDPA')} summary_info += {'Trace backends': config_host['TRACE_BACKENDS']} From patchwork Tue Nov 17 09:19:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401423 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=FPqa+fXB; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0mR0Jkgz9sRK for ; Tue, 17 Nov 2020 20:20:55 +1100 (AEDT) Received: from localhost ([::1]:41576 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kexAS-0004bI-U7 for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:20:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex8r-00021D-Ur for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:13 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:37640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8q-0006Pa-2D for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yB+iWwjcAdJo3aku5jv0oHVt9QpfV3gRJttPbNSWZik=; b=FPqa+fXBqLlnz1evzr4BAY74fBJzaFVq54YNg7k4DCkpCThB/2Tza0H+H9N5qAp18fdpTG Q994ddNVvKBCY1QBdmDrfwegss0Ol9Kaj6ZqNdj8INyHhy9vDKi8knr2RMvCs15CdCd+Kx 5z9ZRkY2aopixv4bsL/aX/dQCOWd3vc= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-JToRFjPPNj2lOaOmaQMqew-1; Tue, 17 Nov 2020 04:19:09 -0500 X-MC-Unique: JToRFjPPNj2lOaOmaQMqew-1 Received: by mail-wr1-f71.google.com with SMTP id e18so12700208wrs.23 for ; Tue, 17 Nov 2020 01:19:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=yB+iWwjcAdJo3aku5jv0oHVt9QpfV3gRJttPbNSWZik=; b=HqmBLHLBP8uFlunop+q0BxjDs25RTW+SxNTE/7u+Ri6bd1vx+mRQN0VkBCEZlhB5bU JgiCkA4nxwlxEUgWvB1hTFhxZVsCQLDjbEl9rVl0M22/ACs0pDMohpGa2L0pUOKSDT+U Ht5JH6FwnhGsuaGn27nl6R3bNOXKAlkdBs3RGYPevzuzSwj3J1EC5mFLk9l0CLtk6jT5 EGMXbEApsbxWDVKhdyfzwTneiwH1E0iOgVsuDyMZdcnCAaCvJcnH+BRCrAz0tcfu7UOl P+rw7pXFMSmXph6p96OnPP65luYHrtHCmYu0j9HRP6tki7/6dcrwE5+LAlF9i0hDNrT7 TbDw== X-Gm-Message-State: AOAM53026tNg/1qHRD/fqf09RlsWiBA6R4cYKw2FSGjOG1Q7hxekHTu7 4d8faN4JIvSX/qGRohTRlOFiL34xXN46nsPU8FVQyjE6EjGuo/io8LRpZNMfPxPJ9lnRGLU5LfW yoxGk8PxsFZxao+dnlQJ0N+Dsl42gG3+jKe1Q1e7578o1jqS1pkHPbXgFFlLa X-Received: by 2002:adf:ea91:: with SMTP id s17mr24183394wrm.349.1605604748113; Tue, 17 Nov 2020 01:19:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4CwnD/LQAUutPnCY/95mmA/mtP7BghVZduSZfnuSBQiLFFJf8KbyZ2JT3FQfE1rmjsaWgHA== X-Received: by 2002:adf:ea91:: with SMTP id s17mr24183370wrm.349.1605604747942; Tue, 17 Nov 2020 01:19:07 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id w10sm27404440wra.34.2020.11.17.01.19.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:07 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:05 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 3/7] vhost-user-blk-server: depend on CONFIG_VHOST_USER Message-ID: <20201117091848.695370-4-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 00:41:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Philippe =?utf-8?q?Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Richard Henderson , Stefan Hajnoczi , Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Alex =?utf-8?q?Benn=C3=A9e?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi I interpreted CONFIG_VHOST_USER as controlling only QEMU's vhost-user device frontends. However, virtiofsd and contrib/ vhost-user device backends are also controlled by CONFIG_VHOST_USER. Make the vhost-user-blk server depend on CONFIG_VHOST_USER for consistency. Now the following error is printed when the vhost-user-blk server is enabled without CONFIG_VHOST_USER: $ ./configure --disable-vhost-user --enable-vhost-user-blk ... ../meson.build:761:8: ERROR: Problem encountered: vhost_user_blk_server requires vhost-user support Suggested-by: Philippe Mathieu-Daudé Suggested-by: Alex Bennée Signed-off-by: Stefan Hajnoczi Message-Id: <20201110171121.1265142-3-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 4b789f18c1..7fd874eec7 100644 --- a/meson.build +++ b/meson.build @@ -751,11 +751,14 @@ statx_test = ''' has_statx = cc.links(statx_test) -have_vhost_user_blk_server = (targetos == 'linux') +have_vhost_user_blk_server = (targetos == 'linux' and + 'CONFIG_VHOST_USER' in config_host) if get_option('vhost_user_blk_server').enabled() if targetos != 'linux' error('vhost_user_blk_server requires linux') + elif 'CONFIG_VHOST_USER' not in config_host + error('vhost_user_blk_server requires vhost-user support') endif elif get_option('vhost_user_blk_server').disabled() or not have_system have_vhost_user_blk_server = false From patchwork Tue Nov 17 09:19:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401427 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Ec2PTRA+; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0pM0DSCz9sSs for ; Tue, 17 Nov 2020 20:22:35 +1100 (AEDT) Received: from localhost ([::1]:49938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kexC4-00083G-VD for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:22:32 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45434) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex8v-00029k-RK for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:17 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:59092) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8t-0006RZ-PL for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604754; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WW3ubRoSnF3KNEtPsddWc59JkzXMJ/9aeihwbTBzIG0=; b=Ec2PTRA+oU+49EFgS7DvvT3E6krCwp9xHiLrCqV2Vi2HG6kGPbTIaArizUAzz3ZvpWLsRt WQ3Ysc5zXJo9sTT4Bfno3eKrhjhZwjBbIk1QLhkOpSW9xcY+iORshdQjyEvuiJ1YPPR8eN fyCjZ5feBAQfqRaCkUQAkb1tjQ6sOI4= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-6-15r8EqsiPDW1NqNwTKCDnw-1; Tue, 17 Nov 2020 04:19:12 -0500 X-MC-Unique: 15r8EqsiPDW1NqNwTKCDnw-1 Received: by mail-wm1-f69.google.com with SMTP id v131so1434068wma.1 for ; Tue, 17 Nov 2020 01:19:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=WW3ubRoSnF3KNEtPsddWc59JkzXMJ/9aeihwbTBzIG0=; b=Fx+ZS/AJLCs2YihYJGmXmZMbP1ug3EAC+xhbDTIxyCjDZqj2LbZGmxUU13RvDCbqCh Vg37Ybx2Ivv57jYksVB359Afmf+gXt4yH/nfAnURKmEznpApfdjKI3O1VJjqYADBe/0/ ddpqbmgXW4jqFA7+TlaMimzAiCgSXxMBKaJKGSKLd8lfBuos2M0O/LPshsZcc+evV8FJ Cz1k8+6FSyva8fwt4dxXCdcFqmiZbWSWH1JuBGsfLh+2JiNj1KsdhCineSgt36fkfLk/ 17+gN0h8o0ftkX4M8ntUD7ltICASvWybh4uWKO2z4eXWs4/QWmkXMwwc0bDKSRwVAIll cLQw== X-Gm-Message-State: AOAM532Ouc0aLnNVt7Q4ZErh+YZee/uw+C2FodcdzKdxq8/L6hj+iBxp DEccUn+iN5wdTBUD8GMpz+z7YT2r3EiHlWUhCjm1+ciyV4Ik7jI7sD5Hga1JImVyv+DVjLN+apQ xBovFavRpCk7Fo/SlA0Ayhwa62wFEYQ1PxNYN+PQXrzqzbLpicjDdrGoK2NFs X-Received: by 2002:a1c:4d0f:: with SMTP id o15mr3207015wmh.142.1605604750938; Tue, 17 Nov 2020 01:19:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJzeKWvCl/BOiKzPc0J8k5/taWfXhJYt9ZOZ6fSZIYWywQ6rGfFQ0+fIkcPPD55d7Y6LS6CRJQ== X-Received: by 2002:a1c:4d0f:: with SMTP id o15mr3206997wmh.142.1605604750705; Tue, 17 Nov 2020 01:19:10 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id v19sm27673031wrf.40.2020.11.17.01.19.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:10 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:08 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 4/7] configure: mark vhost-user Linux-only Message-ID: <20201117091848.695370-5-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 00:41:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Peter Maydell , Thomas Huth , Richard Henderson , Stefan Hajnoczi , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Stefan Hajnoczi The vhost-user protocol uses the Linux eventfd feature and is typically connected to Linux kvm.ko ioeventfd and irqfd file descriptors. The protocol specification in docs/interop/vhost-user.rst does not describe how platforms without eventfd support work. The QEMU vhost-user devices compile on other POSIX host operating systems because eventfd usage is abstracted in QEMU. The libvhost-user programs in contrib/ do not compile but we failed to notice since they are not built by default. Make it clear that vhost-user is only supported on Linux for the time being. If someone wishes to support it on other platforms then the details can be added to vhost-user.rst and CI jobs can test the feature to prevent bitrot. Signed-off-by: Stefan Hajnoczi Message-Id: <20201110171121.1265142-4-stefanha@redhat.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé --- configure | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 516f28a088..3fbc2a0c68 100755 --- a/configure +++ b/configure @@ -328,7 +328,7 @@ vhost_net="" vhost_crypto="" vhost_scsi="" vhost_vsock="" -vhost_user="" +vhost_user="no" vhost_user_blk_server="auto" vhost_user_fs="" kvm="auto" @@ -718,7 +718,6 @@ fi case $targetos in MINGW32*) mingw32="yes" - vhost_user="no" audio_possible_drivers="dsound sdl" if check_include dsound.h; then audio_drv_list="dsound" @@ -797,6 +796,7 @@ Linux) audio_possible_drivers="oss alsa sdl pa" linux="yes" linux_user="yes" + vhost_user="yes" ;; esac @@ -2341,9 +2341,8 @@ 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" +if test "$vhost_user" = "yes" && test "$linux" != "yes"; then + error_exit "vhost-user is only available on Linux" fi test "$vhost_vdpa" = "" && vhost_vdpa=$linux if test "$vhost_vdpa" = "yes" && test "$linux" != "yes"; then From patchwork Tue Nov 17 09:19:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401421 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=AvBDGHPE; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0l92HvPz9sTL for ; Tue, 17 Nov 2020 20:19:49 +1100 (AEDT) Received: from localhost ([::1]:36028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kex9P-0002Lw-7d for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:19:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45484) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex90-0002Ik-8W for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:22 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:27561) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8y-0006Sy-G1 for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fy5h6h+m0qqiK7cH1TYiRgHFXaiX1Q/ASMsmRQ7XhRo=; b=AvBDGHPEBVsbuRSKy+RR+Qi8t7vZ8kSMV6NdstAsX8Nln7vNFSAkBWiQ+mhDUrPROkasu9 RwETh6ghvHr2VyxAlxww97SVBToIRL3i5w6rw30DU4Tp2O8kgSUiczUaAFLhpHZhEu1vEv 3NdI3OLuoxmeNli6EABkladVixpyOnk= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-y9ZNKhkDPXyWo5LHb9WFTQ-1; Tue, 17 Nov 2020 04:19:15 -0500 X-MC-Unique: y9ZNKhkDPXyWo5LHb9WFTQ-1 Received: by mail-wr1-f72.google.com with SMTP id z7so11518903wrl.14 for ; Tue, 17 Nov 2020 01:19:15 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Fy5h6h+m0qqiK7cH1TYiRgHFXaiX1Q/ASMsmRQ7XhRo=; b=BlTYDtWnCt5N5AyINH2zOLeXjQhb4mCOCJ5oA6jXxg/Pm7wA9Q+v6UzJ5CQ61047oi Eaa7oQkwb9v8IojoGkVbRREi2wcSEQLRYTTyXP/v+FvTqxIYsSOapXeC8mlUAXbHaIlo WUPInwkYg7vzSr9Qu8R5s3SI6UMp5zKeow/TKO3MF9UvV1zWg3kytuNTEMMKxvTyFvoc BdzLvfgyso/TNX4GEM/rxXWGqitlFDljNgRfk6oAw/zpV2xtcaZ/VD25uBdL6LuacQWu qocEfAuLG/choUCMw8RbK/7Dpeo9KOG8xCiqy0PG4aJSMAhMxCYsN2MeCcp+eVb8h+nL aAxg== X-Gm-Message-State: AOAM5317/A+puEGGhP0DVra/kChTe3yqUi7qjolRn6ix58ibZuPqWsLX 9LBhEy+xaF1rI/f4HRMqXQ3eEWr8Z1oHDIxhNEjqU+qsjm7xSXAULYWE2K5v6Qz/53cwsQ/wzYi tBNIqvtsO0F6ndjFnsrOV00pRIFQ8aDLGEi/jkuSTla8WYjvsxWOd0ld062bg X-Received: by 2002:a1c:3c44:: with SMTP id j65mr3370315wma.13.1605604754254; Tue, 17 Nov 2020 01:19:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxQpN9CDiJOKeG9FTEHZ1w6HMpm8QyTY+rnUuKmedogSIXEtFikScOQks8+eKiBzSW+DuD2Ig== X-Received: by 2002:a1c:3c44:: with SMTP id j65mr3370288wma.13.1605604754056; Tue, 17 Nov 2020 01:19:14 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id q16sm26780475wrn.13.2020.11.17.01.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:13 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:11 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 5/7] hw/i386/acpi-build: Fix maybe-uninitialized error when ACPI hotplug off Message-ID: <20201117091848.695370-6-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 01:18:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Eduardo Habkost , Igor Mammedov , Ani Sinha , Paolo Bonzini , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé GCC 9.3.0 thinks that 'method' can be left uninitialized. This code is already in the "if (bsel || pcihp_bridge_en)" block statement, but it isn't smart enough to figure it out. Restrict the code to be used only in the "if (bsel || pcihp_bridge_en)" block statement to fix (on Ubuntu): ../hw/i386/acpi-build.c: In function 'build_append_pci_bus_devices': ../hw/i386/acpi-build.c:496:9: error: 'method' may be used uninitialized in this function [-Werror=maybe-uninitialized] 496 | aml_append(parent_scope, method); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Fixes: df4008c9c59 ("piix4: don't reserve hw resources when hotplug is off globally") Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20201107194045.438027-1-philmd@redhat.com> Acked-by: Ani Sinha Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 45 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4f66642d88..1f5c211245 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -465,34 +465,31 @@ static void build_append_pci_bus_devices(Aml *parent_scope, PCIBus *bus, */ if (bsel || pcihp_bridge_en) { method = aml_method("PCNT", 0, AML_NOTSERIALIZED); - } - /* If bus supports hotplug select it and notify about local events */ - if (bsel) { - uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel)); - aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM"))); - aml_append(method, - aml_call2("DVNT", aml_name("PCIU"), aml_int(1) /* Device Check */) - ); - aml_append(method, - aml_call2("DVNT", aml_name("PCID"), aml_int(3)/* Eject Request */) - ); - } + /* If bus supports hotplug select it and notify about local events */ + if (bsel) { + uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel)); - /* Notify about child bus events in any case */ - if (pcihp_bridge_en) { - QLIST_FOREACH(sec, &bus->child, sibling) { - int32_t devfn = sec->parent_dev->devfn; - - if (pci_bus_is_root(sec) || pci_bus_is_express(sec)) { - continue; - } - - aml_append(method, aml_name("^S%.02X.PCNT", devfn)); + aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM"))); + aml_append(method, aml_call2("DVNT", aml_name("PCIU"), + aml_int(1))); /* Device Check */ + aml_append(method, aml_call2("DVNT", aml_name("PCID"), + aml_int(3))); /* Eject Request */ + } + + /* Notify about child bus events in any case */ + if (pcihp_bridge_en) { + QLIST_FOREACH(sec, &bus->child, sibling) { + int32_t devfn = sec->parent_dev->devfn; + + if (pci_bus_is_root(sec) || pci_bus_is_express(sec)) { + continue; + } + + aml_append(method, aml_name("^S%.02X.PCNT", devfn)); + } } - } - if (bsel || pcihp_bridge_en) { aml_append(parent_scope, method); } qobject_unref(bsel); From patchwork Tue Nov 17 09:19:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401425 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Qmk9oKfm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0n74XkKz9sRK for ; Tue, 17 Nov 2020 20:21:31 +1100 (AEDT) Received: from localhost ([::1]:43388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kexB3-0005JY-Hd for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:21:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex91-0002La-Id for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:32566) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex8z-0006Ts-LX for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604761; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=jNBQehzeHZf620Wy5iH4Q5itvrw949b87YQTXO/Cb1Q=; b=Qmk9oKfmZXtwjPGRlZ0ql2hsC8Ab/2jN3JceG8NGIRrhRh8oMulFaKPGLVr91fwDDz5tnU I1PGb3dFU888LQS0c+hfPY2FKCoXw0sUXrKj9MgHYg96GuxNzz/xl7FVR9NxV1m0gCdZez FQeEK9CZWK91pc9ud1CPS8Co4Uahgcw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-9RF2IJVROPOCSJGRV-_6VQ-1; Tue, 17 Nov 2020 04:19:18 -0500 X-MC-Unique: 9RF2IJVROPOCSJGRV-_6VQ-1 Received: by mail-wm1-f69.google.com with SMTP id a134so1235026wmd.8 for ; Tue, 17 Nov 2020 01:19:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=jNBQehzeHZf620Wy5iH4Q5itvrw949b87YQTXO/Cb1Q=; b=j2ao+idRQH9J1fnoi47WUltq4oZL3/Wwe7hDNa2Nl8LF2GV21U43k0xkYp1xLPDlqO raWQrWuzPRfImlY43o82Lh6x3pVHyVYdE0fqmjiq8uV91EezcTv6+FrjSmebiRnYtNrT /QoG/ms1FXq2kedgQZk2E6t/QLemFNSNbxpr/PPzBRXGxELUZgssmbe/MBJjW9dwLVje 4OMeQzoZKUcFfgql4Y44zHhUQNup9GOjYHgOiSrGfEJts7LnUffsFVJzvfDFKHgwUI1p C3hU37f2nC7OHYJCIIy42tjZUybNzFA3dik29mBgz1o81vpvJoX5BMuPa+opxY1n3MdE bImA== X-Gm-Message-State: AOAM53235gBLqAM5TNNu0fGirA4OYn7f9WB/TsovyZCXbdDz/SYtMBfh gcLa6+fW7S+2W4ozmaiTH6WELhqIKvIFIdifPc8XlNDC+KYR0nLQu4GiCUxv5Mg6+dLGEmWsUKU 2ZBzO7dlJR9kfhP1ycG58MsT6+VJCo1NNTcvFsBlWrR/S/g6Q+8gCx9N+QZZc X-Received: by 2002:a1c:1bcb:: with SMTP id b194mr3255843wmb.139.1605604757126; Tue, 17 Nov 2020 01:19:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJyfzE6nH8wlOnuO82mxdNeFL9rfIzxsDp4G9ZFaT4cLGzHDYYJlVbnrHl7Qr2XSOqgsqWJ2Rg== X-Received: by 2002:a1c:1bcb:: with SMTP id b194mr3255820wmb.139.1605604756884; Tue, 17 Nov 2020 01:19:16 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id e3sm10105864wro.90.2020.11.17.01.19.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:16 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:14 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 6/7] contrib/libvhost-user: Fix bad printf format specifiers Message-ID: <20201117091848.695370-7-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=63.128.21.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 00:41:22 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Raphael Norwitz , AlexChen , Stefan Hajnoczi , Euler Robot , =?utf-8?q?Marc-Andr=C3=A9?= Lureau , Philippe =?utf-8?q?Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: AlexChen We should use printf format specifier "%u" instead of "%d" for argument of type "unsigned int". Reported-by: Euler Robot Signed-off-by: Alex Chen Message-Id: <5FA28106.6000901@huawei.com> Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/libvhost-user/libvhost-user.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/contrib/libvhost-user/libvhost-user.c b/contrib/libvhost-user/libvhost-user.c index bfec8a881a..5c73ffdd6b 100644 --- a/contrib/libvhost-user/libvhost-user.c +++ b/contrib/libvhost-user/libvhost-user.c @@ -701,7 +701,7 @@ vu_add_mem_reg(VuDev *dev, VhostUserMsg *vmsg) { return false; } - DPRINT("Adding region: %d\n", dev->nregions); + DPRINT("Adding region: %u\n", dev->nregions); DPRINT(" guest_phys_addr: 0x%016"PRIx64"\n", msg_region->guest_phys_addr); DPRINT(" memory_size: 0x%016"PRIx64"\n", @@ -848,7 +848,7 @@ vu_set_mem_table_exec_postcopy(VuDev *dev, VhostUserMsg *vmsg) VhostUserMemory m = vmsg->payload.memory, *memory = &m; dev->nregions = memory->nregions; - DPRINT("Nregions: %d\n", memory->nregions); + DPRINT("Nregions: %u\n", memory->nregions); for (i = 0; i < dev->nregions; i++) { void *mmap_addr; VhostUserMemoryRegion *msg_region = &memory->regions[i]; @@ -938,7 +938,7 @@ vu_set_mem_table_exec(VuDev *dev, VhostUserMsg *vmsg) return vu_set_mem_table_exec_postcopy(dev, vmsg); } - DPRINT("Nregions: %d\n", memory->nregions); + DPRINT("Nregions: %u\n", memory->nregions); for (i = 0; i < dev->nregions; i++) { void *mmap_addr; VhostUserMemoryRegion *msg_region = &memory->regions[i]; @@ -1049,8 +1049,8 @@ vu_set_vring_num_exec(VuDev *dev, VhostUserMsg *vmsg) unsigned int index = vmsg->payload.state.index; unsigned int num = vmsg->payload.state.num; - DPRINT("State.index: %d\n", index); - DPRINT("State.num: %d\n", num); + DPRINT("State.index: %u\n", index); + DPRINT("State.num: %u\n", num); dev->vq[index].vring.num = num; return false; @@ -1105,8 +1105,8 @@ vu_set_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg) unsigned int index = vmsg->payload.state.index; unsigned int num = vmsg->payload.state.num; - DPRINT("State.index: %d\n", index); - DPRINT("State.num: %d\n", num); + DPRINT("State.index: %u\n", index); + DPRINT("State.num: %u\n", num); dev->vq[index].shadow_avail_idx = dev->vq[index].last_avail_idx = num; return false; @@ -1117,7 +1117,7 @@ vu_get_vring_base_exec(VuDev *dev, VhostUserMsg *vmsg) { unsigned int index = vmsg->payload.state.index; - DPRINT("State.index: %d\n", index); + DPRINT("State.index: %u\n", index); vmsg->payload.state.num = dev->vq[index].last_avail_idx; vmsg->size = sizeof(vmsg->payload.state); @@ -1478,8 +1478,8 @@ vu_set_vring_enable_exec(VuDev *dev, VhostUserMsg *vmsg) unsigned int index = vmsg->payload.state.index; unsigned int enable = vmsg->payload.state.num; - DPRINT("State.index: %d\n", index); - DPRINT("State.enable: %d\n", enable); + DPRINT("State.index: %u\n", index); + DPRINT("State.enable: %u\n", enable); if (index >= dev->max_queues) { vu_panic(dev, "Invalid vring_enable index: %u", index); @@ -1728,7 +1728,7 @@ vu_handle_vring_kick(VuDev *dev, VhostUserMsg *vmsg) return false; } - DPRINT("Got kick message: handler:%p idx:%d\n", + DPRINT("Got kick message: handler:%p idx:%u\n", dev->vq[index].handler, index); if (!dev->vq[index].started) { @@ -1772,7 +1772,7 @@ vu_process_message(VuDev *dev, VhostUserMsg *vmsg) DPRINT("Request: %s (%d)\n", vu_request_to_string(vmsg->request), vmsg->request); DPRINT("Flags: 0x%x\n", vmsg->flags); - DPRINT("Size: %d\n", vmsg->size); + DPRINT("Size: %u\n", vmsg->size); if (vmsg->fd_num) { int i; From patchwork Tue Nov 17 09:19:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael S. Tsirkin" X-Patchwork-Id: 1401426 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SjBcjYZm; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Cb0nK6myDz9sSs for ; Tue, 17 Nov 2020 20:21:41 +1100 (AEDT) Received: from localhost ([::1]:44464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kexBD-0005oz-Sr for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2020 04:21:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:45506) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kex93-0002QG-Fh for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:25 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59532) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kex91-0006UE-MO for qemu-devel@nongnu.org; Tue, 17 Nov 2020 04:19:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605604763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eTDyF8qZ/+kyOvEMv/zkAMXekpV6mWj/zaDDozu+j7g=; b=SjBcjYZmJBdImdOsARh5cxj64mXqujGubyHR7mIgKSH5e0vlF2sK4p4o8c31/E9OQYQqjG 2Dm4UZYn3mSFRYSqARKNJoM5slE0G4lqVlwBPz/X1mhrD4/J5Jh8pbiiX+0KIqtbHj2MBM kFrwt8hnDJpFBYISrgvPs8kgXhDL/+0= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-13-fvVvmPcpNxS9-bVZDuhh8Q-1; Tue, 17 Nov 2020 04:19:20 -0500 X-MC-Unique: fvVvmPcpNxS9-bVZDuhh8Q-1 Received: by mail-wr1-f70.google.com with SMTP id d8so12697322wrr.10 for ; Tue, 17 Nov 2020 01:19:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=eTDyF8qZ/+kyOvEMv/zkAMXekpV6mWj/zaDDozu+j7g=; b=Y+7LpDp9rT8WEYTc35U0RZaOaxl0Lx04EQHxWperYHE4Xq0+I2uMTIGwTM1vxzUDyz lPPbTchgHSPvlLTMtY5TuNZLVtFTZlEQ/LamMN4n9mV8NCah7LsNP5z7ekS1wIkR3/44 /Ftjdq+7vAiIEQmgUPfJDcI6tvipmCxc0NrMXlf6mjBmI5aFfZlghuW3/jewwfsM25ao sOL0ZmD4tpw+LIG1pmw92YIX2Hu5K+n1M0P5r61efU8xqq+AOkVsUzR4UrKklUKfUnQi Q/vb4vMBN8Yni9VO0o0i4ip8AIdtUeYfvNQ9Ig93n+clAUnvJi7Hd9HwHi0Pzog6dQKc Hsmw== X-Gm-Message-State: AOAM530TLYXbtisxJEldnfCJ5SAA5/PedBLQAZ1quNzO/zc8mbLgDNS+ FqZwmssii65KiTvp8TidgZCzZnQnsIW7Vqqsq7m1BXlexYCv4Wu2K8ONdUINNoD2mZCABAS/feH DmvYb28tbXya2iR0dD+NIDo7Kuk3NJEUfwUCZohNtrykkouOdlz0QoMDT8rXR X-Received: by 2002:a5d:6744:: with SMTP id l4mr23263562wrw.378.1605604759447; Tue, 17 Nov 2020 01:19:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBRX4KtkANmoXwUrNvk56/4h6tepZigh9tHtMmw1pPvsjuBqg7qgvMcHmFlPY4cPjYujh3uw== X-Received: by 2002:a5d:6744:: with SMTP id l4mr23263537wrw.378.1605604759160; Tue, 17 Nov 2020 01:19:19 -0800 (PST) Received: from redhat.com (bzq-79-176-118-93.red.bezeqint.net. [79.176.118.93]) by smtp.gmail.com with ESMTPSA id g23sm2658260wmh.21.2020.11.17.01.19.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 01:19:18 -0800 (PST) Date: Tue, 17 Nov 2020 04:19:17 -0500 From: "Michael S. Tsirkin" To: qemu-devel@nongnu.org Subject: [PULL v2 7/7] vhost-user-blk/scsi: Fix broken error handling for socket call Message-ID: <20201117091848.695370-8-mst@redhat.com> References: <20201117091848.695370-1-mst@redhat.com> MIME-Version: 1.0 In-Reply-To: <20201117091848.695370-1-mst@redhat.com> X-Mailer: git-send-email 2.27.0.106.g8ac3dc51b1 X-Mutt-Fcc: =sent Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/17 01:18:45 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: AlexChen , Peter Maydell , Raphael Norwitz , Euler Robot Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: AlexChen When socket() fails, it returns -1, 0 is the normal return value and should not return error. Reported-by: Euler Robot Signed-off-by: AlexChen Message-Id: <5F9A5B48.9030509@huawei.com> Reviewed-by: Raphael Norwitz Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- contrib/vhost-user-blk/vhost-user-blk.c | 2 +- contrib/vhost-user-scsi/vhost-user-scsi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/vhost-user-blk/vhost-user-blk.c b/contrib/vhost-user-blk/vhost-user-blk.c index caad88637e..dc981bf945 100644 --- a/contrib/vhost-user-blk/vhost-user-blk.c +++ b/contrib/vhost-user-blk/vhost-user-blk.c @@ -476,7 +476,7 @@ static int unix_sock_new(char *unix_fn) assert(unix_fn); sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock <= 0) { + if (sock < 0) { perror("socket"); return -1; } diff --git a/contrib/vhost-user-scsi/vhost-user-scsi.c b/contrib/vhost-user-scsi/vhost-user-scsi.c index 3c912384e9..0f9ba4b2a2 100644 --- a/contrib/vhost-user-scsi/vhost-user-scsi.c +++ b/contrib/vhost-user-scsi/vhost-user-scsi.c @@ -320,7 +320,7 @@ static int unix_sock_new(char *unix_fn) assert(unix_fn); sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock <= 0) { + if (sock < 0) { perror("socket"); return -1; }