From nobody Sun Apr 28 16:14:34 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 149997257719334.8577394081467; Thu, 13 Jul 2017 12:02:57 -0700 (PDT) Received: from localhost ([::1]:33586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVjO2-0003Ss-Pr for importer@patchew.org; Thu, 13 Jul 2017 15:02:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVjMc-0002NW-CR for qemu-devel@nongnu.org; Thu, 13 Jul 2017 15:01:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVjMX-0001kh-FQ for qemu-devel@nongnu.org; Thu, 13 Jul 2017 15:01:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55630) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVjMX-0001kE-9D for qemu-devel@nongnu.org; Thu, 13 Jul 2017 15:01:21 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22DD180F7D for ; Thu, 13 Jul 2017 19:01:20 +0000 (UTC) Received: from dgilbert-t530.redhat.com (ovpn-117-102.ams2.redhat.com [10.36.117.102]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83F5561B6B; Thu, 13 Jul 2017 19:01:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 22DD180F7D 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=dgilbert@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 22DD180F7D From: "Dr. David Alan Gilbert (git)" To: qemu-devel@nongnu.org, pbonzini@redhat.com, jsnow@redhat.com Date: Thu, 13 Jul 2017 20:01:16 +0100 Message-Id: <20170713190116.21608-1-dgilbert@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Jul 2017 19:01: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] vl.c/exit: pause cpus before closing block devices 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: , 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" From: "Dr. David Alan Gilbert" There's a rare exit seg if the guest is accessing IO during exit. It's always hitting the atomic_inc(&bs->in_flight) with a NULL bs. This was added recently in 99723548 but I don't see it as the cause. Flip vl.c around so we pause the cpus before closing the block devices, that way we shouldn't have anything trying to access them when they're gone. This was originally Red Hat bz https://bugzilla.redhat.com/show_bug.cgi?id= =3D1451015 Signed-off-by: Dr. David Alan Gilbert Reported-by: Cong Li -- This is a very rare race, I'll leave it running in a loop to see if we hit anything else and to check this really fixes it. I do worry if there are other cases that can trigger this - e.g. hot-unplug or ejecting a CD. Reviewed-by: Stefan Hajnoczi --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index f7560de622..d53f715e91 100644 --- a/vl.c +++ b/vl.c @@ -4787,8 +4787,8 @@ int main(int argc, char **argv, char **envp) replay_disable_events(); iothread_stop_all(); =20 - bdrv_close_all(); pause_all_vcpus(); + bdrv_close_all(); res_free(); =20 /* vhost-user must be cleaned up before chardevs. */ --=20 2.13.0