From patchwork Tue Aug 14 01:37:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emilio Cota X-Patchwork-Id: 10564985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6685613B4 for ; Tue, 14 Aug 2018 01:43:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4E75329420 for ; Tue, 14 Aug 2018 01:43:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 412DD29427; Tue, 14 Aug 2018 01:43:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B3C5529420 for ; Tue, 14 Aug 2018 01:43:10 +0000 (UTC) Received: from localhost ([::1]:42057 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpOMX-00036s-IZ for patchwork-qemu-devel@patchwork.kernel.org; Mon, 13 Aug 2018 21:43:09 -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 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: 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) 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_Benn=C3=A9e?= , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 addr, unsigned size) /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { - return cpu_get_ticks(); + uint64_t ret; + bool locked; + + locked = qemu_mutex_iothread_locked(); + if (!locked) { + qemu_mutex_lock_iothread(); + } + ret = cpu_get_ticks(); + if (!locked) { + qemu_mutex_unlock_iothread(); + } + return ret; } /* IRQ handling */