From nobody Fri Oct 24 11:50:40 2025 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; dkim=fail; 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; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518598309315320.76866481270986; Wed, 14 Feb 2018 00:51:49 -0800 (PST) Received: from localhost ([::1]:53305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elsn6-0006ii-D8 for importer@patchew.org; Wed, 14 Feb 2018 03:51:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1elslt-000660-1v for qemu-devel@nongnu.org; Wed, 14 Feb 2018 03:50:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1elslp-0006Aw-6f for qemu-devel@nongnu.org; Wed, 14 Feb 2018 03:50:33 -0500 Received: from mail-pl0-x243.google.com ([2607:f8b0:400e:c01::243]:38572) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1elslo-0006AQ-Vs for qemu-devel@nongnu.org; Wed, 14 Feb 2018 03:50:29 -0500 Received: by mail-pl0-x243.google.com with SMTP id h10so1572427plt.5 for ; Wed, 14 Feb 2018 00:50:27 -0800 (PST) Received: from localhost.localdomain ([36.255.96.146]) by smtp.gmail.com with ESMTPSA id n24sm41528234pfi.175.2018.02.14.00.50.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Feb 2018 00:50:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9HnEP6m88ga9axPKXEJvauOyYdygXCmAcsH4lUZR1q4=; b=fQJq8JJxZ88hSa9ibnfxwcF2xV5lux6ivZSnVYubZ9JOjWnWgtiNlsBCwcT5CkicbH tUf7zmXUP7QaeU9IqrgJav6YlqoRniB9wTT1fg/wCNpGXuR2R0u1EQXRTfReQxTYQepR J7WnbnoewmAPj5UzJoft6/RKmegXt7han1oqVwBmBTZgRbg6qbcooCJ/kAfy7pePqlN6 Y3LkUUEhvJ8I8FsfvwrdBDXlP3mh/SPS/kNEzwLAxzN9ZxpU3xWBzqmxBT0b60+47qNL QMhtLEjXXEIFqhEGeifpPfPVchacT6OLKoMwK2pqKe2LtX4lvtCVRzstokSj/mAS6c6R fkQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9HnEP6m88ga9axPKXEJvauOyYdygXCmAcsH4lUZR1q4=; b=rzsQKEekx/Y+eq8f+bhhpfIOYfRufpMhF9SFgUwHTjIbzHmJBT9ifC9JPfan+DyMvC ODKZQBpFkf8vhDbjesDqEjp1NphJAfppu4pWOGN2815Zdb7csg8lvptf7mZmQu7WmZWF nfr7DVMjFWrfRQbJfSogGaJZi9Kfn8nzvFw1uBfO0cfuQJoURY78BJ+k5uLdi8d7uaDy 0a6zlOmbeWRSAcTemasFGFFS/qSifBzR+tN+49VvaO90XM2MxOdynfID4ao/p3hTmHPB MHsruqD4SIkYrS9Lirp5aUxXc02FzKOQUcxaqQ1orZKOdzphPUU9LAN172skfdldzqL7 AwyA== X-Gm-Message-State: APf1xPDuBEmegdGREAl3s5CJfojlk6CHAukou7EJls655Y76AQsZXCmo xtDb57FayKQAI3QzbuMGeYYVNw== X-Google-Smtp-Source: AH8x2270pZVHbkH87O2PsHd+fQaOWioYpNqndj4H0dQnVK2CmunoYz9lrKZMYjrUeBx6qZMdtNmCiw== X-Received: by 2002:a17:902:bd01:: with SMTP id p1-v6mr3933188pls.172.1518598226157; Wed, 14 Feb 2018 00:50:26 -0800 (PST) From: Zihan Yang To: qemu-devel@nongnu.org Date: Wed, 14 Feb 2018 16:49:47 +0800 Message-Id: <1518598187-27169-1-git-send-email-whois.zihan.yang@gmail.com> X-Mailer: git-send-email 2.7.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::243 Subject: [Qemu-devel] [PATCH] RAMList: replace QemuMutex with CompatGMutex 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: Paolo Bonzini , Richard Henderson , Zihan Yang , Peter Crosthwaite Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" change the mutex member in RAMList structure from QemuMutex to CompatGMutex. qemu_mutex_init() is just deleted instead of being replaced with g_mutex_in= it() because there is no need to do initialize a mutex that is statically alloca= ted. Signed-off-by: Zihan Yang --- exec.c | 5 ++--- include/exec/ramlist.h | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/exec.c b/exec.c index e8d7b33..90cdd05 100644 --- a/exec.c +++ b/exec.c @@ -1423,12 +1423,12 @@ void qemu_flush_coalesced_mmio_buffer(void) =20 void qemu_mutex_lock_ramlist(void) { - qemu_mutex_lock(&ram_list.mutex); + g_mutex_lock(&ram_list.mutex); } =20 void qemu_mutex_unlock_ramlist(void) { - qemu_mutex_unlock(&ram_list.mutex); + g_mutex_unlock(&ram_list.mutex); } =20 void ram_block_dump(Monitor *mon) @@ -3331,7 +3331,6 @@ void cpu_register_map_client(QEMUBH *bh) =20 void cpu_exec_init_all(void) { - qemu_mutex_init(&ram_list.mutex); /* The data structures we set up here depend on knowing the page size, * so no more changes can be made after this point. * In an ideal world, nothing we did before we had finished the diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h index 2e2ac6c..24be5e4 100644 --- a/include/exec/ramlist.h +++ b/include/exec/ramlist.h @@ -45,7 +45,7 @@ typedef struct { } DirtyMemoryBlocks; =20 typedef struct RAMList { - QemuMutex mutex; + CompatGMutex mutex; RAMBlock *mru_block; /* RCU-enabled, writes protected by the ramlist lock. */ QLIST_HEAD(, RAMBlock) blocks; --=20 2.7.4