From nobody Wed Nov 5 10:12:08 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; 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 1534211015829955.8877198707868; Mon, 13 Aug 2018 18:43:35 -0700 (PDT) Received: from localhost ([::1]:42057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpOMw-00036s-NX for importer@patchew.org; Mon, 13 Aug 2018 21:43:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpOHm-0006H3-Pi for qemu-devel@nongnu.org; Mon, 13 Aug 2018 21:38:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fpOHj-0002GW-KZ for qemu-devel@nongnu.org; Mon, 13 Aug 2018 21:38:14 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:50147) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fpOHj-0002Fv-E0 for qemu-devel@nongnu.org; Mon, 13 Aug 2018 21:38:11 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id C298A21E79; Mon, 13 Aug 2018 21:38:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 13 Aug 2018 21:38:10 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 14E94E450E; Mon, 13 Aug 2018 21:38:10 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=2sDiP4Bvy9+5wa zYlgSUyo/tziIzL8pSFj/tLquQETA=; b=GK21y05D0bdLOYH8Cd5p+cRuWj6Xi/ pWIEzISXk6BX2XQanAPrPkGKVluuFpWHdu/zoMwQQ7/U8SInS7z+91qkT9FW7WNt mWHurLf7H8uI1IxdyJJuFM6fJ9lNkzK1HeeRoMo9NYs2lUJj9BOaciZLUcgTEXMD X93iGzLVuikfk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=2sDiP4Bvy9+5wazYlgSUyo/tziIzL8pSFj/tLquQETA=; b=l/1yVgcj 9nUnithheCnnbDpHblpFzKxgKclItCvO/lSBZb+JIZC2/4fEtgFGYznLbfrXHZMY hTPOA2JHkyKxd8ydaYX1bOpAIqzN0UYJ+wfGaC62Fo5iD7p/DZnzvWYRzyTrxIoS F2kFlQ1aGM7wyz1KT6kRZHoMr6tVjHGulAt4oVqXl8wPz7QJNVC2gSi2oao9TyUt INYxdD4aNqWC52PirXtuIhliCeHrFZWzGbCv5XbBHM8goEF6VCDHwSQoGY97ZU14 ldKBlMEqYZKpc3C8x4AF/GJsyzMR6KC2yhEE17wTLcpOZE9ULwrfvr/1jFHu+WNx 53ef9PJ7OBfblA== X-ME-Proxy: X-ME-Sender: From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 21:37:58 -0400 Message-Id: <20180814013801.26036-2-cota@braap.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180814013801.26036-1-cota@braap.org> References: <20180814013801.26036-1-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.25 Subject: [Qemu-devel] [PATCH 1/4] hw/i386/pc: hold the BQL when calling cpu_get_ticks 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: Eduardo Habkost , "Michael S . Tsirkin" , Peter Crosthwaite , Paolo Bonzini , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Richard Henderson 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" Signed-off-by: Emilio G. Cota --- hw/i386/pc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 83a444472b..7371cd9960 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -158,7 +158,18 @@ static uint64_t ioportF0_read(void *opaque, hwaddr add= r, unsigned size) /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { - return cpu_get_ticks(); + uint64_t ret; + bool locked; + + locked =3D qemu_mutex_iothread_locked(); + if (!locked) { + qemu_mutex_lock_iothread(); + } + ret =3D cpu_get_ticks(); + if (!locked) { + qemu_mutex_unlock_iothread(); + } + return ret; } =20 /* IRQ handling */ --=20 2.17.1