From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279494245113.7760535274682; Mon, 17 Jul 2017 01:18:14 -0700 (PDT) Received: from localhost ([::1]:48687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1EL-0001nz-0v for importer@patchew.org; Mon, 17 Jul 2017 04:18:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56671) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18N-0005KJ-1h for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18L-0001IZ-Oz for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48622) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18L-0001IB-Ft for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:01 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 802314E4D6; Mon, 17 Jul 2017 08:12:00 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 72AF76F444; Mon, 17 Jul 2017 08:11:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 802314E4D6 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 802314E4D6 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:44 +0200 Message-Id: <20170717081152.17153-2-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:12:00 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 1/9] virtio: enhance virtio_error messages 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Output like "Virtqueue size exceeded" is not much useful in identifying the culprit. This commit adds virtio device name (e.g. "virtio-input") and id if set (e.g. "mouse0") to all virtio error messages to improve debuggabilit= y. Some virtio devices (virtio-scsi, virtio-serial) insert a bus between the proxy object and the virtio backends, so a helper function is added to walk the object hierarchy and find the right proxy object to extract the id from. Suggested-by: Stefan Hajnoczi Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck --- hw/virtio/virtio.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 464947f..d7fae54 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -31,6 +31,11 @@ */ #define VIRTIO_PCI_VRING_ALIGN 4096 =20 +/* + * Name of the property linking proxy objects to virtio backend objects. + */ +#define VIRTIO_PROP_BACKEND "virtio-backend" + typedef struct VRingDesc { uint64_t addr; @@ -2223,7 +2228,8 @@ void virtio_instance_init_common(Object *proxy_obj, v= oid *data, DeviceState *vdev =3D data; =20 object_initialize(vdev, vdev_size, vdev_name); - object_property_add_child(proxy_obj, "virtio-backend", OBJECT(vdev), N= ULL); + object_property_add_child(proxy_obj, VIRTIO_PROP_BACKEND, OBJECT(vdev), + NULL); object_unref(OBJECT(vdev)); qdev_alias_all_properties(vdev, proxy_obj); } @@ -2443,14 +2449,34 @@ void virtio_device_set_child_bus_name(VirtIODevice = *vdev, char *bus_name) vdev->bus_name =3D g_strdup(bus_name); } =20 +static const char *virtio_get_device_id(VirtIODevice *vdev) +{ + DeviceState *qdev =3D DEVICE(vdev); + while (qdev) { + /* Find the proxy object corresponding to the vdev backend */ + Object *prop =3D object_property_get_link(OBJECT(qdev), + VIRTIO_PROP_BACKEND, NULL); + if (prop =3D=3D OBJECT(vdev)) { + return qdev->id ? qdev->id : ""; + } + qdev =3D qdev->parent_bus->parent; + } + g_assert_not_reached(); + return ""; +} + void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, = ...) { va_list ap; + char *msg; =20 va_start(ap, fmt); - error_vreport(fmt, ap); + msg =3D g_strdup_vprintf(fmt, ap); va_end(ap); =20 + error_report("%s (id=3D%s): %s", vdev->name, virtio_get_device_id(vdev= ), msg); + g_free(msg); + if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { virtio_set_status(vdev, vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET= ); virtio_notify_config(vdev); --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150027935835968.88221551441745; Mon, 17 Jul 2017 01:15:58 -0700 (PDT) Received: from localhost ([::1]:48680 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1C7-00005Z-5E for importer@patchew.org; Mon, 17 Jul 2017 04:15:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18P-0005KV-4C for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18O-0001Ja-1A for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33956) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18N-0001JE-Nq for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:03 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C419C356D1; Mon, 17 Jul 2017 08:12:02 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6C3F5C2FA; Mon, 17 Jul 2017 08:12:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C419C356D1 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C419C356D1 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:45 +0200 Message-Id: <20170717081152.17153-3-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 17 Jul 2017 08:12:02 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 2/9] virtio: introduce virtqueue_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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Most virtio error output pertains to a specific virtqueue so it makes sense to include the queue index in error messages. Suggested-by: Stefan Hajnoczi Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck --- hw/virtio/virtio.c | 44 +++++++++++++++++++++++++++++++++---------= -- include/hw/virtio/virtio.h | 1 + 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index d7fae54..935a5e3 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2465,18 +2465,8 @@ static const char *virtio_get_device_id(VirtIODevice= *vdev) return ""; } =20 -void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, = ...) +static void virtio_device_set_broken(VirtIODevice *vdev) { - va_list ap; - char *msg; - - va_start(ap, fmt); - msg =3D g_strdup_vprintf(fmt, ap); - va_end(ap); - - error_report("%s (id=3D%s): %s", vdev->name, virtio_get_device_id(vdev= ), msg); - g_free(msg); - if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) { virtio_set_status(vdev, vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET= ); virtio_notify_config(vdev); @@ -2485,6 +2475,38 @@ void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *v= dev, const char *fmt, ...) vdev->broken =3D true; } =20 +void GCC_FMT_ATTR(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, = ...) +{ + va_list ap; + char *msg; + + va_start(ap, fmt); + msg =3D g_strdup_vprintf(fmt, ap); + va_end(ap); + + error_report("%s (id=3D%s): %s", vdev->name, virtio_get_device_id(vdev= ), msg); + g_free(msg); + + virtio_device_set_broken(vdev); +} + +void GCC_FMT_ATTR(2, 3) virtqueue_error(VirtQueue *vq, const char *fmt, ..= .) +{ + VirtIODevice *vdev =3D vq->vdev; + va_list ap; + char *msg; + + va_start(ap, fmt); + msg =3D g_strdup_vprintf(fmt, ap); + va_end(ap); + + error_report("%s (id=3D%s) queue %d: %s", vdev->name, + virtio_get_device_id(vdev), vq->queue_index, msg); + g_free(msg); + + virtio_device_set_broken(vdev); +} + static void virtio_memory_listener_commit(MemoryListener *listener) { VirtIODevice *vdev =3D container_of(listener, VirtIODevice, listener); diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 80c45c3..c6c56a0 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -151,6 +151,7 @@ void virtio_init(VirtIODevice *vdev, const char *name, void virtio_cleanup(VirtIODevice *vdev); =20 void virtio_error(VirtIODevice *vdev, const char *fmt, ...) GCC_FMT_ATTR(2= , 3); +void virtqueue_error(VirtQueue *vq, const char *fmt, ...) GCC_FMT_ATTR(2, = 3); =20 /* Set the child bus name. */ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name); --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150027924191562.75447458794292; Mon, 17 Jul 2017 01:14:01 -0700 (PDT) Received: from localhost ([::1]:48668 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1AG-0006W5-GI for importer@patchew.org; Mon, 17 Jul 2017 04:14:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56711) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18S-0005N3-1u for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18Q-0001Kr-C0 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18Q-0001Ka-2t for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:06 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 15D9C85363; Mon, 17 Jul 2017 08:12:05 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 160A6600C6; Mon, 17 Jul 2017 08:12:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 15D9C85363 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 15D9C85363 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:46 +0200 Message-Id: <20170717081152.17153-4-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 17 Jul 2017 08:12:05 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 3/9] virtio: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Stefan Hajnoczi --- hw/virtio/virtio.c | 57 +++++++++++++++++++++++++++-----------------------= ---- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 935a5e3..de4dd32 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -148,7 +148,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev= , int n) len =3D address_space_cache_init(&new->desc, vdev->dma_as, addr, size, false); if (len < size) { - virtio_error(vdev, "Cannot map desc"); + virtqueue_error(vq, "Cannot map desc"); goto err_desc; } =20 @@ -156,7 +156,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev= , int n) len =3D address_space_cache_init(&new->used, vdev->dma_as, vq->vring.used, size, true); if (len < size) { - virtio_error(vdev, "Cannot map used"); + virtqueue_error(vq, "Cannot map used"); goto err_used; } =20 @@ -164,7 +164,7 @@ static void virtio_init_region_cache(VirtIODevice *vdev= , int n) len =3D address_space_cache_init(&new->avail, vdev->dma_as, vq->vring.avail, size, false); if (len < size) { - virtio_error(vdev, "Cannot map avail"); + virtqueue_error(vq, "Cannot map avail"); goto err_avail; } =20 @@ -522,7 +522,7 @@ static int virtqueue_num_heads(VirtQueue *vq, unsigned = int idx) =20 /* Check it isn't doing very strange things with descriptor numbers. */ if (num_heads > vq->vring.num) { - virtio_error(vq->vdev, "Guest moved used index from %u to %u", + virtqueue_error(vq, "Guest moved used index from %u to %u", idx, vq->shadow_avail_idx); return -EINVAL; } @@ -545,7 +545,7 @@ static bool virtqueue_get_head(VirtQueue *vq, unsigned = int idx, =20 /* If their number is silly, that's a fatal mistake. */ if (*head >=3D vq->vring.num) { - virtio_error(vq->vdev, "Guest says index %u is available", *head); + virtqueue_error(vq, "Guest says index %u is available", *head); return false; } =20 @@ -558,7 +558,7 @@ enum { VIRTQUEUE_READ_DESC_MORE =3D 1, /* more buffers in chain */ }; =20 -static int virtqueue_read_next_desc(VirtIODevice *vdev, VRingDesc *desc, +static int virtqueue_read_next_desc(VirtQueue *vq, VRingDesc *desc, MemoryRegionCache *desc_cache, unsigne= d int max, unsigned int *next) { @@ -573,11 +573,11 @@ static int virtqueue_read_next_desc(VirtIODevice *vde= v, VRingDesc *desc, smp_wmb(); =20 if (*next >=3D max) { - virtio_error(vdev, "Desc next is %u", *next); + virtqueue_error(vq, "Desc next is %u", *next); return VIRTQUEUE_READ_DESC_ERROR; } =20 - vring_desc_read(vdev, desc, desc_cache, *next); + vring_desc_read(vq->vdev, desc, desc_cache, *next); return VIRTQUEUE_READ_DESC_MORE; } =20 @@ -610,7 +610,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned = int *in_bytes, max =3D vq->vring.num; caches =3D vring_get_region_caches(vq); if (caches->desc.len < max * sizeof(VRingDesc)) { - virtio_error(vdev, "Cannot map descriptor ring"); + virtqueue_error(vq, "Cannot map descriptor ring"); goto err; } =20 @@ -630,13 +630,13 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigne= d int *in_bytes, =20 if (desc.flags & VRING_DESC_F_INDIRECT) { if (desc.len % sizeof(VRingDesc)) { - virtio_error(vdev, "Invalid size for indirect buffer table= "); + virtqueue_error(vq, "Invalid size for indirect buffer tabl= e"); goto err; } =20 /* If we've got too many, that implies a descriptor loop. */ if (num_bufs >=3D max) { - virtio_error(vdev, "Looped descriptor"); + virtqueue_error(vq, "Looped descriptor"); goto err; } =20 @@ -646,7 +646,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned = int *in_bytes, desc.addr, desc.len, false); desc_cache =3D &indirect_desc_cache; if (len < desc.len) { - virtio_error(vdev, "Cannot map indirect buffer"); + virtqueue_error(vq, "Cannot map indirect buffer"); goto err; } =20 @@ -658,7 +658,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned = int *in_bytes, do { /* If we've got too many, that implies a descriptor loop. */ if (++num_bufs > max) { - virtio_error(vdev, "Looped descriptor"); + virtqueue_error(vq, "Looped descriptor"); goto err; } =20 @@ -671,7 +671,7 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned = int *in_bytes, goto done; } =20 - rc =3D virtqueue_read_next_desc(vdev, &desc, desc_cache, max, = &i); + rc =3D virtqueue_read_next_desc(vq, &desc, desc_cache, max, &i= ); } while (rc =3D=3D VIRTQUEUE_READ_DESC_MORE); =20 if (rc =3D=3D VIRTQUEUE_READ_DESC_ERROR) { @@ -715,7 +715,7 @@ int virtqueue_avail_bytes(VirtQueue *vq, unsigned int i= n_bytes, return in_bytes <=3D in_total && out_bytes <=3D out_total; } =20 -static bool virtqueue_map_desc(VirtIODevice *vdev, unsigned int *p_num_sg, +static bool virtqueue_map_desc(VirtQueue *vq, unsigned int *p_num_sg, hwaddr *addr, struct iovec *iov, unsigned int max_num_sg, bool is_write, hwaddr pa, size_t sz) @@ -725,7 +725,7 @@ static bool virtqueue_map_desc(VirtIODevice *vdev, unsi= gned int *p_num_sg, assert(num_sg <=3D max_num_sg); =20 if (!sz) { - virtio_error(vdev, "virtio: zero sized buffers are not allowed"); + virtqueue_error(vq, "Zero sized buffers are not allowed"); goto out; } =20 @@ -733,17 +733,16 @@ static bool virtqueue_map_desc(VirtIODevice *vdev, un= signed int *p_num_sg, hwaddr len =3D sz; =20 if (num_sg =3D=3D max_num_sg) { - virtio_error(vdev, "virtio: too many write descriptors in " - "indirect table"); + virtqueue_error(vq, "Too many write descriptors in indirect ta= ble"); goto out; } =20 - iov[num_sg].iov_base =3D dma_memory_map(vdev->dma_as, pa, &len, + iov[num_sg].iov_base =3D dma_memory_map(vq->vdev->dma_as, pa, &len, is_write ? DMA_DIRECTION_FROM_DEVICE : DMA_DIRECTION_TO_DEVICE); if (!iov[num_sg].iov_base) { - virtio_error(vdev, "virtio: bogus descriptor or out of resourc= es"); + virtqueue_error(vq, "Bogus descriptor or out of resources"); goto out; } =20 @@ -862,7 +861,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) max =3D vq->vring.num; =20 if (vq->inuse >=3D vq->vring.num) { - virtio_error(vdev, "Virtqueue size exceeded"); + virtqueue_error(vq, "Virtqueue size exceeded"); goto done; } =20 @@ -878,7 +877,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) =20 caches =3D vring_get_region_caches(vq); if (caches->desc.len < max * sizeof(VRingDesc)) { - virtio_error(vdev, "Cannot map descriptor ring"); + virtqueue_error(vq, "Cannot map descriptor ring"); goto done; } =20 @@ -886,7 +885,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) vring_desc_read(vdev, &desc, desc_cache, i); if (desc.flags & VRING_DESC_F_INDIRECT) { if (desc.len % sizeof(VRingDesc)) { - virtio_error(vdev, "Invalid size for indirect buffer table"); + virtqueue_error(vq, "Invalid size for indirect buffer table"); goto done; } =20 @@ -895,7 +894,7 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) desc.addr, desc.len, false); desc_cache =3D &indirect_desc_cache; if (len < desc.len) { - virtio_error(vdev, "Cannot map indirect buffer"); + virtqueue_error(vq, "Cannot map indirect buffer"); goto done; } =20 @@ -909,16 +908,16 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) bool map_ok; =20 if (desc.flags & VRING_DESC_F_WRITE) { - map_ok =3D virtqueue_map_desc(vdev, &in_num, addr + out_num, + map_ok =3D virtqueue_map_desc(vq, &in_num, addr + out_num, iov + out_num, VIRTQUEUE_MAX_SIZE - out_num, true, desc.addr, desc.len); } else { if (in_num) { - virtio_error(vdev, "Incorrect order for descriptors"); + virtqueue_error(vq, "Incorrect order for descriptors"); goto err_undo_map; } - map_ok =3D virtqueue_map_desc(vdev, &out_num, addr, iov, + map_ok =3D virtqueue_map_desc(vq, &out_num, addr, iov, VIRTQUEUE_MAX_SIZE, false, desc.addr, desc.len); } @@ -928,11 +927,11 @@ void *virtqueue_pop(VirtQueue *vq, size_t sz) =20 /* If we've got too many, that implies a descriptor loop. */ if ((in_num + out_num) > max) { - virtio_error(vdev, "Looped descriptor"); + virtqueue_error(vq, "Looped descriptor"); goto err_undo_map; } =20 - rc =3D virtqueue_read_next_desc(vdev, &desc, desc_cache, max, &i); + rc =3D virtqueue_read_next_desc(vq, &desc, desc_cache, max, &i); } while (rc =3D=3D VIRTQUEUE_READ_DESC_MORE); =20 if (rc =3D=3D VIRTQUEUE_READ_DESC_ERROR) { --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279246452897.1820735868736; Mon, 17 Jul 2017 01:14:06 -0700 (PDT) Received: from localhost ([::1]:48670 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1AK-0006Zw-NZ for importer@patchew.org; Mon, 17 Jul 2017 04:14:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18V-0005Os-9d for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18S-0001MB-Jb for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57966) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18S-0001Lq-Am for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:08 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57890C049D57; Mon, 17 Jul 2017 08:12:07 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E63D600C6; Mon, 17 Jul 2017 08:12:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 57890C049D57 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 57890C049D57 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:47 +0200 Message-Id: <20170717081152.17153-5-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Jul 2017 08:12:07 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 4/9] virtio-9p: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Acked-by: Greg Kurz Reviewed-by: Cornelia Huck Reviewed-by: Stefan Hajnoczi --- hw/9pfs/virtio-9p-device.c | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index 62650b0..cf16b4b 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -54,16 +54,16 @@ static void handle_9p_output(VirtIODevice *vdev, VirtQu= eue *vq) } =20 if (iov_size(elem->in_sg, elem->in_num) < 7) { - virtio_error(vdev, - "The guest sent a VirtFS request without space fo= r " - "the reply"); + virtqueue_error(vq, + "The guest sent a VirtFS request without space= for " + "the reply"); goto out_free_req; } =20 len =3D iov_to_buf(elem->out_sg, elem->out_num, 0, &out, 7); if (len !=3D 7) { - virtio_error(vdev, "The guest sent a malformed VirtFS request:= " - "header size is %zd, should be 7", len); + virtqueue_error(vq, "The guest sent a malformed VirtFS request= : " + "header size is %zd, should be 7", len); goto out_free_req; } =20 @@ -150,10 +150,8 @@ static ssize_t virtio_pdu_vmarshal(V9fsPDU *pdu, size_= t offset, =20 ret =3D v9fs_iov_vmarshal(elem->in_sg, elem->in_num, offset, 1, fmt, a= p); if (ret < 0) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(v); - - virtio_error(vdev, "Failed to encode VirtFS reply type %d", - pdu->id + 1); + virtqueue_error(v->vq, "Failed to encode VirtFS reply type %d", + pdu->id + 1); } return ret; } @@ -168,9 +166,8 @@ static ssize_t virtio_pdu_vunmarshal(V9fsPDU *pdu, size= _t offset, =20 ret =3D v9fs_iov_vunmarshal(elem->out_sg, elem->out_num, offset, 1, fm= t, ap); if (ret < 0) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(v); - - virtio_error(vdev, "Failed to decode VirtFS request type %d", pdu-= >id); + virtqueue_error(v->vq, "Failed to decode VirtFS request type %d", + pdu->id); } return ret; } @@ -184,11 +181,9 @@ static void virtio_init_in_iov_from_pdu(V9fsPDU *pdu, = struct iovec **piov, size_t buf_size =3D iov_size(elem->in_sg, elem->in_num); =20 if (buf_size < size) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(v); - - virtio_error(vdev, - "VirtFS reply type %d needs %zu bytes, buffer has %zu= ", - pdu->id + 1, size, buf_size); + virtqueue_error(v->vq, + "VirtFS reply type %d needs %zu bytes, buffer has = %zu", + pdu->id + 1, size, buf_size); } =20 *piov =3D elem->in_sg; @@ -204,11 +199,9 @@ static void virtio_init_out_iov_from_pdu(V9fsPDU *pdu,= struct iovec **piov, size_t buf_size =3D iov_size(elem->out_sg, elem->out_num); =20 if (buf_size < size) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(v); - - virtio_error(vdev, - "VirtFS request type %d needs %zu bytes, buffer has %= zu", - pdu->id, size, buf_size); + virtqueue_error(v->vq, + "VirtFS request type %d needs %zu bytes, " + "buffer has %zu", pdu->id, size, buf_size); } =20 *piov =3D elem->out_sg; --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279244218567.1777897267675; Mon, 17 Jul 2017 01:14:04 -0700 (PDT) Received: from localhost ([::1]:48669 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1AI-0006Y5-Md for importer@patchew.org; Mon, 17 Jul 2017 04:14:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56730) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18V-0005P5-Jw for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18U-0001Ms-Li for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18U-0001Ma-Fv for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7ACB64E4D4; Mon, 17 Jul 2017 08:12:09 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E356600C6; Mon, 17 Jul 2017 08:12:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7ACB64E4D4 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7ACB64E4D4 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:48 +0200 Message-Id: <20170717081152.17153-6-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Jul 2017 08:12:09 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 5/9] virtio-blk: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Stefan Hajnoczi --- hw/block/virtio-blk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c index b750bd8..359d8bd 100644 --- a/hw/block/virtio-blk.c +++ b/hw/block/virtio-blk.c @@ -490,20 +490,20 @@ static int virtio_blk_handle_request(VirtIOBlockReq *= req, MultiReqBuffer *mrb) VirtIODevice *vdev =3D VIRTIO_DEVICE(s); =20 if (req->elem.out_num < 1 || req->elem.in_num < 1) { - virtio_error(vdev, "virtio-blk missing headers"); + virtqueue_error(req->vq, "virtio-blk missing headers"); return -1; } =20 if (unlikely(iov_to_buf(iov, out_num, 0, &req->out, sizeof(req->out)) !=3D sizeof(req->out))) { - virtio_error(vdev, "virtio-blk request outhdr too short"); + virtqueue_error(req->vq, "virtio-blk request outhdr too short"); return -1; } =20 iov_discard_front(&iov, &out_num, sizeof(req->out)); =20 if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_blk_inhdr)) { - virtio_error(vdev, "virtio-blk request inhdr too short"); + virtqueue_error(req->vq, "virtio-blk request inhdr too short"); return -1; } =20 --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 150027937692247.89693814801308; Mon, 17 Jul 2017 01:16:16 -0700 (PDT) Received: from localhost ([::1]:48682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1CQ-0000Ma-SA for importer@patchew.org; Mon, 17 Jul 2017 04:16:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18X-0005Qs-T9 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18W-0001R5-TW for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35174) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18W-0001OK-KY for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9407F83F47; Mon, 17 Jul 2017 08:12:11 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF45E600C6; Mon, 17 Jul 2017 08:12:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9407F83F47 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9407F83F47 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:49 +0200 Message-Id: <20170717081152.17153-7-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 17 Jul 2017 08:12:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 6/9] virtio-net: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Stefan Hajnoczi --- hw/net/virtio-net.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 5630a9e..b3d0b85 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -970,7 +970,7 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, = VirtQueue *vq) } if (iov_size(elem->in_sg, elem->in_num) < sizeof(status) || iov_size(elem->out_sg, elem->out_num) < sizeof(ctrl)) { - virtio_error(vdev, "virtio-net ctrl missing headers"); + virtqueue_error(vq, "virtio-net ctrl missing headers"); virtqueue_detach_element(vq, elem, 0); g_free(elem); break; @@ -1204,20 +1204,20 @@ static ssize_t virtio_net_receive_rcu(NetClientStat= e *nc, const uint8_t *buf, elem =3D virtqueue_pop(q->rx_vq, sizeof(VirtQueueElement)); if (!elem) { if (i) { - virtio_error(vdev, "virtio-net unexpected empty queue: " - "i %zd mergeable %d offset %zd, size %zd, " - "guest hdr len %zd, host hdr len %zd " - "guest features 0x%" PRIx64, - i, n->mergeable_rx_bufs, offset, size, - n->guest_hdr_len, n->host_hdr_len, - vdev->guest_features); + virtqueue_error(q->rx_vq, "virtio-net unexpected empty que= ue: " + "i %zd mergeable %d offset %zd, size %zd, " + "guest hdr len %zd, host hdr len %zd " + "guest features 0x%" PRIx64, + i, n->mergeable_rx_bufs, offset, size, + n->guest_hdr_len, n->host_hdr_len, + vdev->guest_features); } return -1; } =20 if (elem->in_num < 1) { - virtio_error(vdev, - "virtio-net receive queue contains no in buffers"= ); + virtqueue_error(q->rx_vq, + "virtio-net receive queue contains no in buffe= rs"); virtqueue_detach_element(q->rx_vq, elem, 0); g_free(elem); return -1; @@ -1333,7 +1333,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) out_num =3D elem->out_num; out_sg =3D elem->out_sg; if (out_num < 1) { - virtio_error(vdev, "virtio-net header not in first element"); + virtqueue_error(q->tx_vq, "virtio-net header not in first elem= ent"); virtqueue_detach_element(q->tx_vq, elem, 0); g_free(elem); return -EINVAL; @@ -1342,7 +1342,7 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q) if (n->has_vnet_hdr) { if (iov_to_buf(out_sg, out_num, 0, &mhdr, n->guest_hdr_len) < n->guest_hdr_len) { - virtio_error(vdev, "virtio-net header incorrect"); + virtqueue_error(q->tx_vq, "virtio-net header incorrect"); virtqueue_detach_element(q->tx_vq, elem, 0); g_free(elem); return -EINVAL; --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279514792829.0648147011287; Mon, 17 Jul 2017 01:18:34 -0700 (PDT) Received: from localhost ([::1]:48688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1Ee-00022U-KJ for importer@patchew.org; Mon, 17 Jul 2017 04:18:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56775) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18e-0005WW-Pb for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18b-0001U0-Lm for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39028) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18b-0001Tf-G9 for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:17 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CB66C0587E4; Mon, 17 Jul 2017 08:12:16 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id DAC22600C6; Mon, 17 Jul 2017 08:12:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7CB66C0587E4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7CB66C0587E4 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:50 +0200 Message-Id: <20170717081152.17153-8-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 17 Jul 2017 08:12:16 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 7/9] virtio-scsi: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Stefan Hajnoczi --- hw/scsi/virtio-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/scsi/virtio-scsi.c b/hw/scsi/virtio-scsi.c index eb63944..436d9b9 100644 --- a/hw/scsi/virtio-scsi.c +++ b/hw/scsi/virtio-scsi.c @@ -84,7 +84,7 @@ static void virtio_scsi_complete_req(VirtIOSCSIReq *req) =20 static void virtio_scsi_bad_req(VirtIOSCSIReq *req) { - virtio_error(VIRTIO_DEVICE(req->dev), "wrong size for virtio-scsi head= ers"); + virtqueue_error(req->vq, "wrong size for virtio-scsi headers"); virtqueue_detach_element(req->vq, &req->elem, 0); virtio_scsi_free_req(req); } --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279377183651.1052995823695; Mon, 17 Jul 2017 01:16:17 -0700 (PDT) Received: from localhost ([::1]:48681 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1CP-0000L8-QW for importer@patchew.org; Mon, 17 Jul 2017 04:16:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56787) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18f-0005WX-Im for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18d-0001Up-Ri for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58332) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18d-0001UT-IP for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:19 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 927CBC049D57; Mon, 17 Jul 2017 08:12:18 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id C3021600C6; Mon, 17 Jul 2017 08:12:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 927CBC049D57 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 927CBC049D57 From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:51 +0200 Message-Id: <20170717081152.17153-9-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 17 Jul 2017 08:12:18 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 8/9] virtio-crypto: use virtqueue_error for errors with queue context 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virtqueue_error includes the queue index in the error output and is preferr= ed for errors that pertain to a virtqueue rather than to the device as a whole. Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Gonglei Reviewed-by: Stefan Hajnoczi --- hw/virtio/virtio-crypto.c | 49 ++++++++++++++++++++++++-------------------= ---- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c index 19c82e0..eaf2ed3 100644 --- a/hw/virtio/virtio-crypto.c +++ b/hw/virtio/virtio-crypto.c @@ -61,7 +61,8 @@ virtio_crypto_cipher_session_helper(VirtIODevice *vdev, info->cipher_key =3D g_malloc(info->key_len); s =3D iov_to_buf(*iov, num, 0, info->cipher_key, info->key_len); if (unlikely(s !=3D info->key_len)) { - virtio_error(vdev, "virtio-crypto cipher key incorrect"); + virtqueue_error(vcrypto->ctrl_vq, + "virtio-crypto cipher key incorrect"); return -EFAULT; } iov_discard_front(iov, &num, info->key_len); @@ -131,7 +132,7 @@ virtio_crypto_create_sym_session(VirtIOCrypto *vcrypto, s =3D iov_to_buf(iov, out_num, 0, info.auth_key, info.auth_key_len); if (unlikely(s !=3D info.auth_key_len)) { - virtio_error(vdev, + virtqueue_error(vcrypto->ctrl_vq, "virtio-crypto authenticated key incorrect"); ret =3D -EFAULT; goto err; @@ -229,7 +230,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) break; } if (elem->out_num < 1 || elem->in_num < 1) { - virtio_error(vdev, "virtio-crypto ctrl missing headers"); + virtqueue_error(vq, "virtio-crypto ctrl missing headers"); virtqueue_detach_element(vq, elem, 0); g_free(elem); break; @@ -241,7 +242,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) in_iov =3D elem->in_sg; if (unlikely(iov_to_buf(out_iov, out_num, 0, &ctrl, sizeof(ctrl)) !=3D sizeof(ctrl))) { - virtio_error(vdev, "virtio-crypto request ctrl_hdr too short"); + virtqueue_error(vq, "virtio-crypto request ctrl_hdr too short"= ); virtqueue_detach_element(vq, elem, 0); g_free(elem); break; @@ -274,7 +275,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) =20 s =3D iov_from_buf(in_iov, in_num, 0, &input, sizeof(input)); if (unlikely(s !=3D sizeof(input))) { - virtio_error(vdev, "virtio-crypto input incorrect"); + virtqueue_error(vq, "virtio-crypto input incorrect"); virtqueue_detach_element(vq, elem, 0); break; } @@ -290,7 +291,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) /* The status only occupy one byte, we can directly use it */ s =3D iov_from_buf(in_iov, in_num, 0, &status, sizeof(status)); if (unlikely(s !=3D sizeof(status))) { - virtio_error(vdev, "virtio-crypto status incorrect"); + virtqueue_error(vq, "virtio-crypto status incorrect"); virtqueue_detach_element(vq, elem, 0); break; } @@ -306,7 +307,7 @@ static void virtio_crypto_handle_ctrl(VirtIODevice *vde= v, VirtQueue *vq) stl_le_p(&input.status, VIRTIO_CRYPTO_NOTSUPP); s =3D iov_from_buf(in_iov, in_num, 0, &input, sizeof(input)); if (unlikely(s !=3D sizeof(input))) { - virtio_error(vdev, "virtio-crypto input incorrect"); + virtqueue_error(vq, "virtio-crypto input incorrect"); virtqueue_detach_element(vq, elem, 0); break; } @@ -370,7 +371,7 @@ virtio_crypto_sym_input_data_helper(VirtIODevice *vdev, /* Save the cipher result */ s =3D iov_from_buf(req->in_iov, req->in_num, 0, sym_op_info->dst, len); if (s !=3D len) { - virtio_error(vdev, "virtio-crypto dest data incorrect"); + virtqueue_error(req->vq, "virtio-crypto dest data incorrect"); return; } =20 @@ -383,7 +384,7 @@ virtio_crypto_sym_input_data_helper(VirtIODevice *vdev, sym_op_info->digest_result, sym_op_info->digest_result_len); if (s !=3D sym_op_info->digest_result_len) { - virtio_error(vdev, "virtio-crypto digest result incorrect"); + virtqueue_error(req->vq, "virtio-crypto digest result incorrec= t"); } } } @@ -414,12 +415,13 @@ virtio_crypto_get_request(VirtIOCrypto *s, VirtQueue = *vq) } =20 static CryptoDevBackendSymOpInfo * -virtio_crypto_sym_op_helper(VirtIODevice *vdev, +virtio_crypto_sym_op_helper(VirtIOCryptoReq *request, struct virtio_crypto_cipher_para *cipher_para, struct virtio_crypto_alg_chain_data_para *alg_chain_para, struct iovec *iov, unsigned int out_num) { - VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(vdev); + VirtIOCrypto *vcrypto =3D VIRTIO_CRYPTO(request->vcrypto); + VirtQueue *vq =3D request->vq; CryptoDevBackendSymOpInfo *op_info; uint32_t src_len =3D 0, dst_len =3D 0; uint32_t iv_len =3D 0; @@ -454,7 +456,7 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev, =20 max_len =3D (uint64_t)iv_len + aad_len + src_len + dst_len + hash_resu= lt_len; if (unlikely(max_len > vcrypto->conf.max_size)) { - virtio_error(vdev, "virtio-crypto too big length"); + virtqueue_error(vq, "virtio-crypto too big length"); return NULL; } =20 @@ -475,7 +477,7 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev, =20 s =3D iov_to_buf(iov, out_num, 0, op_info->iv, op_info->iv_len); if (unlikely(s !=3D op_info->iv_len)) { - virtio_error(vdev, "virtio-crypto iv incorrect"); + virtqueue_error(vq, "virtio-crypto iv incorrect"); goto err; } iov_discard_front(&iov, &out_num, op_info->iv_len); @@ -489,7 +491,7 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev, =20 s =3D iov_to_buf(iov, out_num, 0, op_info->aad_data, op_info->aad_= len); if (unlikely(s !=3D op_info->aad_len)) { - virtio_error(vdev, "virtio-crypto additional auth data incorre= ct"); + virtqueue_error(vq, "virtio-crypto additional auth data incorr= ect"); goto err; } iov_discard_front(&iov, &out_num, op_info->aad_len); @@ -504,7 +506,7 @@ virtio_crypto_sym_op_helper(VirtIODevice *vdev, =20 s =3D iov_to_buf(iov, out_num, 0, op_info->src, op_info->src_len); if (unlikely(s !=3D op_info->src_len)) { - virtio_error(vdev, "virtio-crypto source data incorrect"); + virtqueue_error(vq, "virtio-crypto source data incorrect"); goto err; } iov_discard_front(&iov, &out_num, op_info->src_len); @@ -532,26 +534,25 @@ err: } =20 static int -virtio_crypto_handle_sym_req(VirtIOCrypto *vcrypto, +virtio_crypto_handle_sym_req(VirtIOCryptoReq *request, struct virtio_crypto_sym_data_req *req, CryptoDevBackendSymOpInfo **sym_op_info, struct iovec *iov, unsigned int out_num) { - VirtIODevice *vdev =3D VIRTIO_DEVICE(vcrypto); uint32_t op_type; CryptoDevBackendSymOpInfo *op_info; =20 op_type =3D ldl_le_p(&req->op_type); =20 if (op_type =3D=3D VIRTIO_CRYPTO_SYM_OP_CIPHER) { - op_info =3D virtio_crypto_sym_op_helper(vdev, &req->u.cipher.para, + op_info =3D virtio_crypto_sym_op_helper(request, &req->u.cipher.pa= ra, NULL, iov, out_num); if (!op_info) { return -EFAULT; } op_info->op_type =3D op_type; } else if (op_type =3D=3D VIRTIO_CRYPTO_SYM_OP_ALGORITHM_CHAINING) { - op_info =3D virtio_crypto_sym_op_helper(vdev, NULL, + op_info =3D virtio_crypto_sym_op_helper(request, NULL, &req->u.chain.para, iov, out_num); if (!op_info) { @@ -573,7 +574,7 @@ static int virtio_crypto_handle_request(VirtIOCryptoReq *request) { VirtIOCrypto *vcrypto =3D request->vcrypto; - VirtIODevice *vdev =3D VIRTIO_DEVICE(vcrypto); + VirtQueue *vq =3D request->vq; VirtQueueElement *elem =3D &request->elem; int queue_index =3D virtio_crypto_vq2q(virtio_get_queue_index(request-= >vq)); struct virtio_crypto_op_data_req req; @@ -589,7 +590,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) Error *local_err =3D NULL; =20 if (elem->out_num < 1 || elem->in_num < 1) { - virtio_error(vdev, "virtio-crypto dataq missing headers"); + virtqueue_error(vq, "virtio-crypto dataq missing headers"); return -1; } =20 @@ -599,14 +600,14 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) in_iov =3D elem->in_sg; if (unlikely(iov_to_buf(out_iov, out_num, 0, &req, sizeof(req)) !=3D sizeof(req))) { - virtio_error(vdev, "virtio-crypto request outhdr too short"); + virtqueue_error(vq, "virtio-crypto request outhdr too short"); return -1; } iov_discard_front(&out_iov, &out_num, sizeof(req)); =20 if (in_iov[in_num - 1].iov_len < sizeof(struct virtio_crypto_inhdr)) { - virtio_error(vdev, "virtio-crypto request inhdr too short"); + virtqueue_error(vq, "virtio-crypto request inhdr too short"); return -1; } /* We always touch the last byte, so just see how big in_iov is. */ @@ -629,7 +630,7 @@ virtio_crypto_handle_request(VirtIOCryptoReq *request) switch (opcode) { case VIRTIO_CRYPTO_CIPHER_ENCRYPT: case VIRTIO_CRYPTO_CIPHER_DECRYPT: - ret =3D virtio_crypto_handle_sym_req(vcrypto, + ret =3D virtio_crypto_handle_sym_req(request, &req.u.sym_req, &sym_op_info, out_iov, out_num); --=20 2.9.3 From nobody Fri May 3 08:40:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1500279621815298.26323040394345; Mon, 17 Jul 2017 01:20:21 -0700 (PDT) Received: from localhost ([::1]:48693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX1GN-0003Wn-Id for importer@patchew.org; Mon, 17 Jul 2017 04:20:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dX18g-0005WY-Ly for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dX18g-0001W5-0M for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34450) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dX18f-0001VI-QB for qemu-devel@nongnu.org; Mon, 17 Jul 2017 04:12:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC57F2F86CD; Mon, 17 Jul 2017 08:12:20 +0000 (UTC) Received: from dhcp-1-107.brq.redhat.com (unknown [10.43.2.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id D8823600C6; Mon, 17 Jul 2017 08:12:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AC57F2F86CD Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=lprosek@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AC57F2F86CD From: Ladi Prosek To: qemu-devel@nongnu.org Date: Mon, 17 Jul 2017 10:11:52 +0200 Message-Id: <20170717081152.17153-10-lprosek@redhat.com> In-Reply-To: <20170717081152.17153-1-lprosek@redhat.com> References: <20170717081152.17153-1-lprosek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 17 Jul 2017 08:12:20 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 9/9] checkpatch: add virtio_error and virtqueue_error to error funcs 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: casasfernando@hotmail.com, mst@redhat.com, jasowang@redhat.com, cohuck@redhat.com, armbru@redhat.com, groug@kaod.org, arei.gonglei@huawei.com, aneesh.kumar@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Two more error functions that should not contain newlines. Suggested-by: Greg Kurz Signed-off-by: Ladi Prosek Reviewed-by: Cornelia Huck Reviewed-by: Greg Kurz Reviewed-by: Markus Armbruster Reviewed-by: Stefan Hajnoczi --- scripts/checkpatch.pl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 4e91122..2cd2713 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2540,7 +2540,9 @@ sub process { info_vreport| error_report| warn_report| - info_report}x; + info_report| + virtio_error| + virtqueue_error}x; =20 if ($rawline =3D~ /\b(?:$qemu_error_funcs)\s*\(.*\".*\\n/) { ERROR("Error messages should not contain newlines\n" . $herecurr); --=20 2.9.3