From nobody Thu May 9 23:53:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1664917747; cv=none; d=zohomail.com; s=zohoarc; b=Y4fV3qKzdjri79U8YmkH+Hj7pJGJAxxznryc85FGxKTl7WAY1yuGludYSFz/J48c8lc/PUzWTVahRaA9oJ2Oy99rgxu1cAjLBE8laoxUMK/G+YARNAoBE5ewZ514vpDlyCbSPP5q8/tM3xmlhdExJ5wAfw0eBoezuHIUshhrom4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664917747; h=Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=0HpfF3mR6/vcXLfv21Li9DA1zK03IWlg2iDz9cmWwxA=; b=Iz4e2gyEzX8TjSbdgBwlcTqe25G4crixaZt9uUgdg9GDG2GLaUH7YKt1s15j+D9yCQYf80QksDFSyc5abYWBZa6HDYr+S1pcGla87afxkD8HOlNUY9a6mua3os+AR2aAB5TeH37N5rEfflOfhZq8KqSvE/MHwPJrvwdK59+zpsQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664917747990753.047141531546; Tue, 4 Oct 2022 14:09:07 -0700 (PDT) Received: from localhost ([::1]:43594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofpA1-00057P-OJ for importer@patchew.org; Tue, 04 Oct 2022 17:09:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55814) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofp5U-0000L8-IS for qemu-devel@nongnu.org; Tue, 04 Oct 2022 17:04:24 -0400 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:51258) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofp5Q-00088Y-JL for qemu-devel@nongnu.org; Tue, 04 Oct 2022 17:04:24 -0400 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 294L44Bn008389; Tue, 4 Oct 2022 21:04:15 GMT Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jxbyn7etw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Oct 2022 21:04:15 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 294KpkUh033831; Tue, 4 Oct 2022 21:04:14 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3jxc04m447-1; Tue, 04 Oct 2022 21:04:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2022-7-12; bh=0HpfF3mR6/vcXLfv21Li9DA1zK03IWlg2iDz9cmWwxA=; b=WZflX+tZaxqPzoGydnwJuo4dmxZ4lXF4LvHdEzUqpOzKv8XhUWgyne35Jg1i0OS5RsFn u/Wm9pGidogzmPzTclaHK0z3J5a8K7HNqWIfZjyqDho/MvavTnyH9VvNux2F21yn6fDw lUiQ+YqPm9Fjom1IlxxTth0of4za8Dy+8QIAt1ilCvHjfia9eP5v1v4pyXRDwwSrqPkg kQey36GwonJvVGH81kPO+dwoFpps7AyB/yz1fHDzy00jWC8GqXAAuQbcXuV03KVUU0Mj /91rLxW6rRf2BIzMVA2/F0dDyQy4q/fdrM92g3ZvAvpGc6xGF4hXW1MC/vkh3TjJ2nfs JA== From: Si-Wei Liu To: qemu-devel@nongnu.org Cc: jasowang@redhat.com, eblake@redhat.com, armbru@redhat.com Subject: [PATCH] vhost-vdpa: fix assert !virtio_net_get_subqueue(nc)->async_tx.elem in virtio_net_reset Date: Tue, 4 Oct 2022 12:58:43 -0700 Message-Id: <1664913523-3287-1-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-10-04_09,2022-09-29_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 phishscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210040136 X-Proofpoint-GUID: 6q07QZ_83WoLldiOfesOatMvL5XzAWp5 X-Proofpoint-ORIG-GUID: 6q07QZ_83WoLldiOfesOatMvL5XzAWp5 Received-SPF: pass (zohomail.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; Received-SPF: pass client-ip=205.220.177.32; envelope-from=si-wei.liu@oracle.com; helo=mx0b-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @oracle.com) X-ZM-MESSAGEID: 1664917748604100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The citing commit has incorrect code in vhost_vdpa_receive() that returns zero instead of full packet size to the caller. This renders pending packets unable to be freed so then get clogged in the tx queue forever. When device is being reset later on, below assertion failure ensues: 0 0x00007f86d53bb387 in raise () from /lib64/libc.so.6 1 0x00007f86d53bca78 in abort () from /lib64/libc.so.6 2 0x00007f86d53b41a6 in __assert_fail_base () from /lib64/libc.so.6 3 0x00007f86d53b4252 in __assert_fail () from /lib64/libc.so.6 4 0x000055b8f6ff6fcc in virtio_net_reset (vdev=3D) at /usr/= src/debug/qemu/hw/net/virtio-net.c:563 5 0x000055b8f7012fcf in virtio_reset (opaque=3D0x55b8faf881f0) at /usr/src= /debug/qemu/hw/virtio/virtio.c:1993 6 0x000055b8f71f0086 in virtio_bus_reset (bus=3Dbus@entry=3D0x55b8faf88178= ) at /usr/src/debug/qemu/hw/virtio/virtio-bus.c:102 7 0x000055b8f71f1620 in virtio_pci_reset (qdev=3D) at /usr/= src/debug/qemu/hw/virtio/virtio-pci.c:1845 8 0x000055b8f6fafc6c in memory_region_write_accessor (mr=3D= , addr=3D, value=3D, size=3D, shift=3D, mask=3D,= attrs=3D...) at /usr/src/debug/qemu/memory.c:483 9 0x000055b8f6fadce9 in access_with_adjusted_size (addr=3Daddr@entry=3D20,= value=3Dvalue@entry=3D0x7f867e7fb7e8, size=3Dsize@entry=3D1, access_size_min=3D, access_size_max=3D, ac= cess_fn=3D0x55b8f6fafc20 , mr=3D0x55b8faf80a50, attrs=3D...) at /usr/src/debug/qemu/memory.c:544 10 0x000055b8f6fb1d0b in memory_region_dispatch_write (mr=3Dmr@entry=3D0x55= b8faf80a50, addr=3Daddr@entry=3D20, data=3D0, op=3D, attrs=3Dattrs@entry=3D...) at /usr/src/debug/qemu/memory.c:1470 11 0x000055b8f6f62ada in flatview_write_continue (fv=3Dfv@entry=3D0x7f86ac0= 4cd20, addr=3Daddr@entry=3D549755813908, attrs=3D..., attrs@entry=3D..., buf=3Dbuf@entry=3D0x7f86d0223028
, len=3Dlen@entry=3D1, addr1=3D20, l=3D1, mr=3D0x55b8faf80a50) at /usr/src/debug/qemu/exec.c:3266 12 0x000055b8f6f62c8f in flatview_write (fv=3D0x7f86ac04cd20, addr=3D549755= 813908, attrs=3D..., buf=3D0x7f86d0223028
, len=3D1) at= /usr/src/debug/qemu/exec.c:3306 13 0x000055b8f6f674cb in address_space_write (as=3D, addr=3D= , attrs=3D..., buf=3D, len=3D) at /usr/src/debug/qemu/exec.c:3396 14 0x000055b8f6f67575 in address_space_rw (as=3D, addr=3D, attrs=3D..., attrs@entry=3D..., buf=3Dbuf@entry=3D0x7f86d0223028
,= len=3D, is_write=3D) at /usr/src/debug/qemu/exec.c:3406 15 0x000055b8f6fc1cc8 in kvm_cpu_exec (cpu=3Dcpu@entry=3D0x55b8f9aa0e10) at= /usr/src/debug/qemu/accel/kvm/kvm-all.c:2410 16 0x000055b8f6fa5f5e in qemu_kvm_cpu_thread_fn (arg=3D0x55b8f9aa0e10) at /= usr/src/debug/qemu/cpus.c:1318 17 0x000055b8f7336e16 in qemu_thread_start (args=3D0x55b8f9ac8480) at /usr/= src/debug/qemu/util/qemu-thread-posix.c:519 18 0x00007f86d575aea5 in start_thread () from /lib64/libpthread.so.0 19 0x00007f86d5483b2d in clone () from /lib64/libc.so.6 Make vhost_vdpa_receive() return the size passed in as is, so that the caller qemu_deliver_packet_iov() would eventually propagate it back to virtio_net_flush_tx() to release pending packets from the async_tx queue. Which corresponds to the drop path where qemu_sendv_packet_async() returns non-zero in virtio_net_flush_tx(). Fixes: 846a1e85da64 ("vdpa: Add dummy receive callback") Cc: Eugenio Perez Martin Signed-off-by: Si-Wei Liu --- net/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 4bc3fd0..182b3a1 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -211,7 +211,7 @@ static bool vhost_vdpa_check_peer_type(NetClientState *= nc, ObjectClass *oc, static ssize_t vhost_vdpa_receive(NetClientState *nc, const uint8_t *buf, size_t size) { - return 0; + return size; } =20 static NetClientInfo net_vhost_vdpa_info =3D { --=20 1.8.3.1