From nobody Fri May 3 03:12:11 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 155390419191165.8034474642975; Fri, 29 Mar 2019 17:03:11 -0700 (PDT) Received: from localhost ([127.0.0.1]:36409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hA1SZ-0005Cc-PF for importer@patchew.org; Fri, 29 Mar 2019 20:02:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hA11P-0000oB-Ps for qemu-devel@nongnu.org; Fri, 29 Mar 2019 19:34:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hA048-0003fA-8X for qemu-devel@nongnu.org; Fri, 29 Mar 2019 18:33:37 -0400 Received: from mga14.intel.com ([192.55.52.115]:44153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hA047-0003eP-Ub for qemu-devel@nongnu.org; Fri, 29 Mar 2019 18:33:36 -0400 Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Mar 2019 15:33:32 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by fmsmga007.fm.intel.com with ESMTP; 29 Mar 2019 15:33:31 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,286,1549958400"; d="scan'208";a="138607381" From: Zhang Chen To: Zhang Chen , "Dr. David Alan Gilbert" , Juan Quintela , qemu-dev Date: Sat, 30 Mar 2019 06:29:51 +0800 Message-Id: <20190329222951.28945-1-chen.zhang@intel.com> X-Mailer: git-send-email 2.17.GIT X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Subject: [Qemu-devel] [PATCH] migration/ram.c: Fix codes conflict about bitmap_mutex 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: Zhang Chen , Wei 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" From: Zhang Chen I found upstream codes conflict with COLO and lead to crash, and I located to this patch: commit 386a907b37a9321bc5d699bc37104d6ffba1b34d Author: Wei Wang Date: Tue Dec 11 16:24:49 2018 +0800 migration: use bitmap_mutex in migration_bitmap_clear_dirty My colleague Wei's patch add bitmap_mutex in migration_bitmap_clear_dirty, but COLO didn't initialize the bitmap_mutex. So we always get an error when COLO start up. like that: qemu-system-x86_64: util/qemu-thread-posix.c:64: qemu_mutex_lock_impl: Asse= rtion `mutex->initialized' failed. This patch add the bitmap_mutex initialize and destroy in COLO lifecycle. Signed-off-by: Zhang Chen Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Wei Wang --- migration/ram.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/migration/ram.c b/migration/ram.c index d7f8fe45a8..f68beeeeff 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -3918,6 +3918,7 @@ int colo_init_ram_cache(void) } ram_state =3D g_new0(RAMState, 1); ram_state->migration_dirty_pages =3D 0; + qemu_mutex_init(&ram_state->bitmap_mutex); memory_global_dirty_log_start(); =20 return 0; @@ -3956,6 +3957,7 @@ void colo_release_ram_cache(void) } =20 rcu_read_unlock(); + qemu_mutex_destroy(&ram_state->bitmap_mutex); g_free(ram_state); ram_state =3D NULL; } --=20 2.17.GIT