From nobody Sat May 18 12:29:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558084161; cv=none; d=zoho.com; s=zohoarc; b=m1Djx+rG/M+S4zOMppjbT3nSBrdvWm9xuRvk9ZPjF49E6/HYo6R6RDsd53DYz8x4h0f6s6kFoyVo41/eGqrB5piewmuH64Oi/mfzHatNeJk2d57+nFidCFpUSZ2+K8+9Jkl2BoVBH9UiQ8WET/oQlCfSmEreou6a4j1qJ2/DQm4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558084161; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4OA2zo4f6xw9xL+6umdkKzggq5PFrH14iuzcuU/uYHw=; b=DDs17FrnQAyrDK0Ib8u7BWsryuc6aKNTQbdZVMQbQzvX2/RgdI/FwInaoEuJYeJzX1CEqaBtunbULTBxjEShvWQideGpIA3LMF0qzu62qMUCF1Q3g5Yo7mYe/SB7Dcc7nafO8UC5N87WCbt9cHOMvV7vOCcZZplI/aaZIg8kbGU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558084161566654.0050354011051; Fri, 17 May 2019 02:09:21 -0700 (PDT) Received: from localhost ([127.0.0.1]:44907 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYrV-0005re-8V for importer@patchew.org; Fri, 17 May 2019 05:09:09 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYpY-0004Tl-4D for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRYpW-0003iS-4X for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41426) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRYpV-0003i6-Va for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9C860308FBB1; Fri, 17 May 2019 09:07:04 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-157.pek2.redhat.com [10.72.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51A7260BE0; Fri, 17 May 2019 09:07:01 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 17 May 2019 17:06:54 +0800 Message-Id: <1558084017-15947-2-git-send-email-jasowang@redhat.com> In-Reply-To: <1558084017-15947-1-git-send-email-jasowang@redhat.com> References: <1558084017-15947-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Fri, 17 May 2019 09:07:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] vhost_net: don't set backend for the uninitialized virtqueue 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: Jason Wang Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We used to set backend unconditionally, this won't work for some guests (e.g windows driver) who may not initialize all virtqueues. For kernel backend, this will fail since it may try to validate the rings during setting backend. Fixing this by simply skipping the backend set when we find desc is not ready. Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- hw/net/vhost_net.c | 10 ++++++++++ hw/virtio/virtio.c | 5 +++++ include/hw/virtio/virtio.h | 1 + 3 files changed, 16 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index be3cc88..a6b7190 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -244,6 +244,11 @@ static int vhost_net_start_one(struct vhost_net *net, qemu_set_fd_handler(net->backend, NULL, NULL, NULL); file.fd =3D net->backend; for (file.index =3D 0; file.index < net->dev.nvqs; ++file.index) { + if (!virtio_queue_enabled(dev, net->dev.vq_index + + file.index)) { + /* Queue might not be ready for start */ + continue; + } r =3D vhost_net_set_backend(&net->dev, &file); if (r < 0) { r =3D -errno; @@ -256,6 +261,11 @@ fail: file.fd =3D -1; if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { while (file.index-- > 0) { + if (!virtio_queue_enabled(dev, net->dev.vq_index + + file.index)) { + /* Queue might not be ready for start */ + continue; + } int r =3D vhost_net_set_backend(&net->dev, &file); assert(r >=3D 0); } diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 2626a89..28056a7 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2318,6 +2318,11 @@ hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev= , int n) return vdev->vq[n].vring.desc; } =20 +bool virtio_queue_enabled(VirtIODevice *vdev, int n) +{ + return virtio_queue_get_desc_addr(vdev, n) !=3D 0; +} + hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n) { return vdev->vq[n].vring.avail; diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index ce95162..7140381 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -282,6 +282,7 @@ typedef struct VirtIORNGConf VirtIORNGConf; VIRTIO_F_IOMMU_PLATFORM, false) =20 hwaddr virtio_queue_get_desc_addr(VirtIODevice *vdev, int n); +bool virtio_queue_enabled(VirtIODevice *vdev, int n); hwaddr virtio_queue_get_avail_addr(VirtIODevice *vdev, int n); hwaddr virtio_queue_get_used_addr(VirtIODevice *vdev, int n); hwaddr virtio_queue_get_desc_size(VirtIODevice *vdev, int n); --=20 2.5.0 From nobody Sat May 18 12:29:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558084163; cv=none; d=zoho.com; s=zohoarc; b=EcbHo+9cFJlXXxBZ0PZzvwK/oVLfCp6AxDSxaKfegnuU87WI+hXQjYzzoL7J4ls4DRWL23NspYM14aqhDOJOsnbqTej8SvV7DuY31mjKq+42xXZL3AsdwaM+XK8fsWXW9yTcYkSZ2ZSvT3A+CbuOeGxRaizn9oFWPcbNr23XD7s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558084163; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=y2BWY7UnZRH71cU4cjeyPomEHbOf7rKfsC90VwyWmOI=; b=gzWzcnwWccL0geXCICpqvj+Ub69k5OJYyBbfVfq2oqXfCOgqj3xqYOHaYYc6du7Cp2ty/uVbQwjliBXYNksrAwoVyFu6dC+zPd9b+slb5drCzkxz5EFmbnnmOJAQW53MtE40Bq2uHo0rzTh8/Hibmc/qrVu0zJ8w7NyRrCagNMQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155808416335670.56409309250307; Fri, 17 May 2019 02:09:23 -0700 (PDT) Received: from localhost ([127.0.0.1]:44909 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYra-0005xL-9e for importer@patchew.org; Fri, 17 May 2019 05:09:14 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYpZ-0004Uv-U6 for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRYpY-0003jq-Bp for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46516) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRYpY-0003iq-4R for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:08 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6D4E81DE3; Fri, 17 May 2019 09:07:06 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-157.pek2.redhat.com [10.72.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 229F860BE0; Fri, 17 May 2019 09:07:04 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 17 May 2019 17:06:55 +0800 Message-Id: <1558084017-15947-3-git-send-email-jasowang@redhat.com> In-Reply-To: <1558084017-15947-1-git-send-email-jasowang@redhat.com> References: <1558084017-15947-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 17 May 2019 09:07:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/4] e1000: Never increment the RX undersize count register 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: Jason Wang , Chris Kenna Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Chris Kenna In situations where e1000 receives an undersized Ethernet frame, QEMU increments the emulated "Receive Undersize Count (RUC)" register when padding the frame. This is incorrect because this an expected scenario (e.g. with VLAN tag stripping) and not an error. As such, QEMU should not increment the emulated RUC. Fixes: 3b2743017749 ("e1000: Implementing various counters") Reviewed-by: Mark Kanda Reviewed-by: Bhavesh Davda Reviewed-by: Stefano Garzarella Signed-off-by: Chris Kenna Signed-off-by: Jason Wang --- hw/net/e1000.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/net/e1000.c b/hw/net/e1000.c index 9b39bcc..121452d 100644 --- a/hw/net/e1000.c +++ b/hw/net/e1000.c @@ -901,7 +901,6 @@ e1000_receive_iov(NetClientState *nc, const struct iove= c *iov, int iovcnt) if (size < sizeof(min_buf)) { iov_to_buf(iov, iovcnt, 0, min_buf, size); memset(&min_buf[size], 0, sizeof(min_buf) - size); - e1000x_inc_reg_if_not_full(s->mac_reg, RUC); min_iov.iov_base =3D filter_buf =3D min_buf; min_iov.iov_len =3D size =3D sizeof(min_buf); iovcnt =3D 1; --=20 2.5.0 From nobody Sat May 18 12:29:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558084278; cv=none; d=zoho.com; s=zohoarc; b=fWLGCP+oQ6xMD7Us+/7Jh4se6O/zpQ+uhemQHDBTFA4YlfyX70nOhiKmlO2pXBqnFiirxMHfCYm2doxeh52gR8gTin/dXAPbAaAJUTI3l8P+0ZSM5azZB1VGCPvHZpQrtFlRWriZR8vWBX/ak+jyjRCwD7qRuxCZGhGAYPP3C6Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558084278; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DYUeeKAbqf1qW58bPwpo7akaITezPJ8OOXrkG3yls+g=; b=MMN1z7zI3YFC51VHhP/of4I6ISPKCxWLIHuDe6L92VzgIcVM9J4Q86VsvAY/+1LJFwxaEU0EUNMPLcVqbnX7926cqJhPkTLkRgxisfKzaSKaUqLQtT8ojGnbTQPJCxfshtvnhzzxVu/WPYYaVcEe/x7TSY8D3QkoiIgWJwQRm/k= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558084278910449.6370075640018; Fri, 17 May 2019 02:11:18 -0700 (PDT) Received: from localhost ([127.0.0.1]:44968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYtT-0008AF-MS for importer@patchew.org; Fri, 17 May 2019 05:11:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34781) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYpb-0004WZ-RB for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRYpa-0003mq-Mb for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58714) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRYpZ-0003kn-Vl for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:10 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D1BDA3DE04; Fri, 17 May 2019 09:07:08 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-157.pek2.redhat.com [10.72.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CB7E60BE0; Fri, 17 May 2019 09:07:06 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 17 May 2019 17:06:56 +0800 Message-Id: <1558084017-15947-4-git-send-email-jasowang@redhat.com> In-Reply-To: <1558084017-15947-1-git-send-email-jasowang@redhat.com> References: <1558084017-15947-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 17 May 2019 09:07:08 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/4] net/slirp: fix the IPv6 prefix length error message 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: Jason Wang , Stefano Garzarella Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Stefano Garzarella Reword and add a missing parentheses at the end of the error message. Signed-off-by: Stefano Garzarella Reviewed-by: Marc-Andr=C3=A9 Lureau Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Markus Armbruster Signed-off-by: Jason Wang --- net/slirp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/slirp.c b/net/slirp.c index 95934fb..b34cb29 100644 --- a/net/slirp.c +++ b/net/slirp.c @@ -498,7 +498,8 @@ static int net_slirp_init(NetClientState *peer, const c= har *model, } if (vprefix6_len < 0 || vprefix6_len > 126) { error_setg(errp, - "Invalid prefix provided (prefix len must be in range 0= -126"); + "Invalid IPv6 prefix provided " + "(IPv6 prefix length must be between 0 and 126)"); return -1; } =20 --=20 2.5.0 From nobody Sat May 18 12:29:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1558084174; cv=none; d=zoho.com; s=zohoarc; b=fhQYv7PY7CIED1pBPHnRYrQbDwIqjYvJ6aotAFTtXqi6+/HD9ogJIekbCjMU8FQ90OFA/jpzcI0o2yvdv3hS+J5V99DNkAGzUV5TKUmde6OLIlkeFiTEz0GfD+ooRxQeajBR419ccBzF6bKWL3qPuQGaOh9pgBsV7vg0n1mTnYM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558084174; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mzLgpckMq7HX1l+Qwkqiq1rq4+CajcD2w7UHl2vUJ2I=; b=Bt2PydI1MSfOMqMj/6Z90gT5QJzZL4FzG8x3K2eeQK5MdN2qd4wj+//23UPVLyw0F9i+9Jq9g0ArJ9BJ/yfw8KUbil6OorFzcTgTnDN5J6zml7IeHN8OryrmIUnyB5rRTnADoPoys87m/BOI+oo8XHzjjNfSSoBlstNLFsSN3Uk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1558084174209106.6552568839777; Fri, 17 May 2019 02:09:34 -0700 (PDT) Received: from localhost ([127.0.0.1]:44911 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYro-00069E-2M for importer@patchew.org; Fri, 17 May 2019 05:09:28 -0400 Received: from eggs.gnu.org ([209.51.188.92]:34795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRYph-0004bn-Lt for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRYpf-0003rh-Pb for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hRYpd-0003p3-Rj for qemu-devel@nongnu.org; Fri, 17 May 2019 05:07:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED4E130BDE44; Fri, 17 May 2019 09:07:11 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-157.pek2.redhat.com [10.72.12.157]) by smtp.corp.redhat.com (Postfix) with ESMTP id 596B860FAF; Fri, 17 May 2019 09:07:09 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 17 May 2019 17:06:57 +0800 Message-Id: <1558084017-15947-5-git-send-email-jasowang@redhat.com> In-Reply-To: <1558084017-15947-1-git-send-email-jasowang@redhat.com> References: <1558084017-15947-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 17 May 2019 09:07:12 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/4] net/colo-compare.c: Fix a crash in COLO Primary. 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: Jason Wang , Lukas Straub Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Lukas Straub Because event_unhandled_count may be accessed concurrently, it needs to be protected by taking the lock. However the assert is outside the lock, probably causing it to read garbage and aborting Qemu erroneously. The Bug only happens when running Qemu in COLO mode. This Patch fixes the following bug: https://bugs.launchpad.net/qemu/+bug/18= 24622 Signed-off-by: Lukas Straub Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Zhang Chen Signed-off-by: Jason Wang --- net/colo-compare.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index bf10526..fcb4911 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -813,9 +813,8 @@ static void colo_compare_handle_event(void *opaque) break; } =20 - assert(event_unhandled_count > 0); - qemu_mutex_lock(&event_mtx); + assert(event_unhandled_count > 0); event_unhandled_count--; qemu_cond_broadcast(&event_complete_cond); qemu_mutex_unlock(&event_mtx); --=20 2.5.0