From nobody Tue Feb 10 04:16:21 2026 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1494476195713789.9206988863195; Wed, 10 May 2017 21:16:35 -0700 (PDT) Received: from localhost ([::1]:45860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fWj-0006fT-Pk for importer@patchew.org; Thu, 11 May 2017 00:16:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d8fUr-0005HN-Db for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d8fUq-0001LO-Az for qemu-devel@nongnu.org; Thu, 11 May 2017 00:14:37 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:40907) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d8fUp-0001HD-Il; Thu, 11 May 2017 00:14:36 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3wNfrQ3Vg1z9sDG; Thu, 11 May 2017 14:14:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1494476070; bh=3sPX0lD/s/bxtB0rSwADCxNOw1OXWqanCwRmEkaICTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H9I6rbS3cylQ1JEq8jUBc4v5HH4OCWfZ+vY9J8h/USMtJFSO/UnMF0Cuq4SJtFh3T YEByZE50zd67rAraguUrb6pfgr+Tn/Y+XDXMDsJjJnDT1VL0bFWfEb2Dk1BHKtKzyx wNHk6n+evyK5w/iQKTwYbKxix++yZFlBDwlZM7uU= From: David Gibson To: peter.maydell@linaro.org Date: Thu, 11 May 2017 14:14:06 +1000 Message-Id: <20170511041426.6488-4-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170511041426.6488-1-david@gibson.dropbear.id.au> References: <20170511041426.6488-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PULL 03/23] cputlb: handle first atomic write to the page 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: mdroth@linux.vnet.ibm.com, nikunj@linux.vnet.ibm.com, aik@ozlabs.ru, mark.cave-ayland@ilande.co.uk, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, clg@kaod.org, sjitindarsingh@gmail.com, bharata@linux.vnet.ibm.com, sam.bobroff@au1.ibm.com, David Gibson 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" From: Nikunj A Dadhania In case where the conditional write is the first write to the page, TLB_NOTDIRTY will be set and stop_the_world is triggered. Handle this as a special case and set the dirty bit. After that fall through to the actual atomic instruction below. Signed-off-by: Nikunj A Dadhania Reviewed-by: Richard Henderson Signed-off-by: David Gibson --- cputlb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cputlb.c b/cputlb.c index f5d056c..743776a 100644 --- a/cputlb.c +++ b/cputlb.c @@ -930,7 +930,13 @@ static void *atomic_mmu_lookup(CPUArchState *env, targ= et_ulong addr, tlb_addr =3D tlbe->addr_write; } =20 - /* Notice an IO access, or a notdirty page. */ + /* Check notdirty */ + if (unlikely(tlb_addr & TLB_NOTDIRTY)) { + tlb_set_dirty(ENV_GET_CPU(env), addr); + tlb_addr =3D tlb_addr & ~TLB_NOTDIRTY; + } + + /* Notice an IO access */ if (unlikely(tlb_addr & ~TARGET_PAGE_MASK)) { /* There's really nothing that can be done to support this apart from stop-the-world. */ --=20 2.9.3