From patchwork Tue Aug 1 16:17:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 796316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="ANf76w5a"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xMM1q2Ln2z9sR8 for ; Wed, 2 Aug 2017 02:18:23 +1000 (AEST) Received: from localhost ([::1]:43581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZsD-0004KL-4n for incoming@patchwork.ozlabs.org; Tue, 01 Aug 2017 12:18:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dcZrT-0004Iz-Q0 for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dcZrR-00079p-Rt for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:35 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:35344) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dcZrR-00078v-LB for qemu-devel@nongnu.org; Tue, 01 Aug 2017 12:17:33 -0400 Received: by mail-wr0-x242.google.com with SMTP id c24so1805028wra.2 for ; Tue, 01 Aug 2017 09:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ITo/nAbKvDXMxYoIZBD/d0edgNSNoev5N1DIxuuUfOA=; b=ANf76w5aMgyL7vAMP7bg/AbkUAJXft0d8hJER27CuuVMgpar6uwo/Q/Yu5B6yshp/n wYhmE2FNQSsTepw3d+uVtbYjW6/5Bpv4gaB1TPsxbmP0m2dLKUFpOFyQOEsaPARCTeSV CT5/Fa3EtJ+jmPpNL5H0I6DcBepQAcujhgsQUtSQf0kNujLX9AVLxd/IzP1HPazCukaN F6Rq3ogcf7UD+BkK0MJrLTRvK2HzMeHe1F07sMBpUSqDGr4EeDkpw/jPJglFrnTQsoBj GHR+4Ru9cFjo3BX0jQc/d1q/eaWlJ0418eN1t/RUjmIW2jDjfCtX+MjjLfLP78LR9P3t lUTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ITo/nAbKvDXMxYoIZBD/d0edgNSNoev5N1DIxuuUfOA=; b=eoryVW8ekwksRJStu5OTk0AXZ3zdOVamh2mz6Ry77+jrZfmW5ss9SRN/in/rxi9xw2 V0mcKmM7QwFleil+5BELT7OZbzI3LGfAwlxuo9ASLNz+BuVzTTosVZdQNwQLP0b3Puue mcFQyNMKOHvtzYZkyrHsprcc4lLIVLTxYBoqrmLOaXJXqGqKitZYZLh6KMy/UIgrV/f9 Vebg+QIt43c/GwIe4szEelaLAPU25AzoB+Q/RZ0MlKA38jjYWBZBLF3PfRCIq0s2Dclp m+nbZHUmDWM6zIXhsyMv3XVZh8HHXdP7CbRIPxSno2godmvzXRtpvyqgwo2fYV1Z+B9E /JZg== X-Gm-Message-State: AIVw1127ozkc1bLvnjUA5vQgmmQqs3R0Rv1XZjmekbDSoePMReC7/9na oi543OEWjqtitMJT7Lk= X-Received: by 10.223.171.200 with SMTP id s66mr17217176wrc.38.1501604250521; Tue, 01 Aug 2017 09:17:30 -0700 (PDT) Received: from 640k.lan (94-39-192-75.adsl-ull.clienti.tiscali.it. [94.39.192.75]) by smtp.gmail.com with ESMTPSA id u187sm1724160wmd.26.2017.08.01.09.17.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Aug 2017 09:17:29 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 1 Aug 2017 18:17:09 +0200 Message-Id: <1501604245-33460-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> References: <1501604245-33460-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 01/17] 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: , Cc: "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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=1451015 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. Message-Id: <20170713190116.21608-1-dgilbert@redhat.com> Signed-off-by: Paolo Bonzini --- vl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vl.c b/vl.c index fb6b2ef..dd803fc 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(); - bdrv_close_all(); pause_all_vcpus(); + bdrv_close_all(); res_free(); /* vhost-user must be cleaned up before chardevs. */