From nobody Mon Feb 9 20:17:44 2026 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=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1636425523; cv=none; d=zohomail.com; s=zohoarc; b=lYBh7e4YczTBX9qoQV1+TQWGCsqfnzobCx+Q0WT/F78eVhtOQKiX++e/hqHOUbCYwD12M5NRVm7Z6chH358roKZ/Gdh/UEXxL1l/bi2SNah1EqdlfA6Bcycw/OjbW+waTW2SFpRu148tIm9tRJtVPXMNCGxUNDqPOMYQNEAv8jE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1636425523; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=Y3uG1QAC8DB6Cz/eH20tvwgy4XDMp0TTadmN8MEH1S4=; b=UiK1Swx7vNLzHaqeJqAMqABHk0BLi5H0d35scGWVJN4YfdnhceDPUx5G4mUpRnc5UqY3K2GdstU+M5hibMg3SyCTktAXGBeJAAVBZSDujdDuCFXJNOgO57o5aCnHdXHyiFXEAcwoO9c0Gb7fXzXxGSnfgv3Ks8SE9+oeVL+YPkg= 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 1636425523828444.0723486600725; Mon, 8 Nov 2021 18:38:43 -0800 (PST) Received: from localhost ([::1]:55036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkH21-0007OX-Or for importer@patchew.org; Mon, 08 Nov 2021 21:38:41 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkH1M-0006k9-9b for qemu-devel@nongnu.org; Mon, 08 Nov 2021 21:38:00 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:56326) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkH1I-0003xL-6G for qemu-devel@nongnu.org; Mon, 08 Nov 2021 21:37:58 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-295-BuKtW4TlMk6lYjLNVj27gA-1; Mon, 08 Nov 2021 21:37:51 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 11589102CB79 for ; Tue, 9 Nov 2021 02:37:51 +0000 (UTC) Received: from laptop.redhat.com (ovpn-12-34.pek2.redhat.com [10.72.12.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id C04F35C23A; Tue, 9 Nov 2021 02:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636425473; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Y3uG1QAC8DB6Cz/eH20tvwgy4XDMp0TTadmN8MEH1S4=; b=Hppl76ubAoXSiuVKwYlY9YYzSPi7gzlGZVr3e4LydeA0x5o2jfksUL+9ciG3/1ZB1Noa8h dpMRqe3YdNfO1pJ4X0Bs82FfYCnbpk57eFln+AVwDifgF+ijV0opepwyjijmUhu7OOpS3i 91BYoDAYPHS/BVkggiUowpbDO1/MGzM= X-MC-Unique: BuKtW4TlMk6lYjLNVj27gA-1 From: Cindy Lu To: lulu@redhat.com, mst@redhat.com, jasowang@redhat.com, qemu-devel@nongnu.org Subject: [PATCH] virtio-mmio : fix the crash in the vm shutdown Date: Tue, 9 Nov 2021 10:37:44 +0800 Message-Id: <20211109023744.22387-1-lulu@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lulu@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable 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=170.10.129.124; envelope-from=lulu@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.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 @redhat.com) X-ZM-MESSAGEID: 1636425525610100001 Content-Type: text/plain; charset="utf-8" The root cause for this crash is the ioeventfd not stopped while the VM sto= p. The callback for vmstate_change was not implement in virtio-mmio bus Reproduce step load the vm with -M microvm \ -netdev tap,id=3Dnet0,vhostforce,script=3Dno,downscript=3Dno \ -device virtio-net-device,netdev=3Dnet0\ After the VM boot, login the vm and then shutdown the vm System will crash [Current thread is 1 (Thread 0x7ffff6edde00 (LWP 374378))] (gdb) bt 0 0x00005555558f18b4 in qemu_flush_or_purge_queued_packets (purge=3Dfalse,= nc=3D0x55500252e850) at ../net/net.c:636 1 qemu_flush_queued_packets (nc=3D0x55500252e850) at ../net/net.c:656 2 0x0000555555b6c363 in virtio_queue_notify_vq (vq=3D0x7fffe7e2b010) at ..= /hw/virtio/virtio.c:2339 3 virtio_queue_host_notifier_read (n=3D0x7fffe7e2b08c) at ../hw/virtio/vir= tio.c:3583 4 0x0000555555de7b5a in aio_dispatch_handler (ctx=3Dctx@entry=3D0x5555567c= 5780, node=3D0x555556b83fd0) at ../util/aio-posix.c:329 5 0x0000555555de8454 in aio_dispatch_ready_handlers (ready_list=3D, ctx=3D) at ../util/aio-posix.c:359 6 aio_poll (ctx=3D0x5555567c5780, blocking=3Dblocking@entry=3Dfalse) at ..= /util/aio-posix.c:662 7 0x0000555555cce0cc in monitor_cleanup () at ../monitor/monitor.c:645 8 0x0000555555b06bd2 in qemu_cleanup () at ../softmmu/runstate.c:822 9 0x000055555586e693 in main (argc=3D, argv=3D, envp=3D) at ../softmmu/main.c:51 Signed-off-by: Cindy Lu Acked-by: Jason Wang ioeventfd_enabled =3D virtio_mmio_ioeventfd_enabled; k->ioeventfd_assign =3D virtio_mmio_ioeventfd_assign; k->pre_plugged =3D virtio_mmio_pre_plugged; + k->vmstate_change =3D virtio_mmio_vmstate_change; k->has_variable_vring_alignment =3D true; bus_class->max_dev =3D 1; bus_class->get_dev_path =3D virtio_mmio_bus_get_dev_path; --=20 2.21.3