From patchwork Fri Oct 13 18:19:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev\" via" X-Patchwork-Id: 10005631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7F46360230 for ; Fri, 13 Oct 2017 18:21:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A81C2912B for ; Fri, 13 Oct 2017 18:21:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BE012912F; Fri, 13 Oct 2017 18:21:18 +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=-6.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 BE4BC2912B for ; Fri, 13 Oct 2017 18:21:17 +0000 (UTC) Received: from localhost ([::1]:51450 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e34aC-0005Lm-Au for patchwork-qemu-devel@patchwork.kernel.org; Fri, 13 Oct 2017 14:21:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e34ZV-0005LV-NZ for qemu-devel@nongnu.org; Fri, 13 Oct 2017 14:20:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e34ZQ-0007ro-PL for qemu-devel@nongnu.org; Fri, 13 Oct 2017 14:20:33 -0400 Received: from mail-bl2nam02on0115.outbound.protection.outlook.com ([104.47.38.115]:62752 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1e34ZQ-0007rB-Hj for qemu-devel@nongnu.org; Fri, 13 Oct 2017 14:20:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=sWcK5H2eaZT9etLe/0OPbPO4ubn0KXauI4bVl6b7eA0=; b=YQxhzJK+icS/SyeOO9pNR6S2+qkzNVPNAR2ffgG2ZfjLnxNmvFH1nx/CO60/vF5pbYdRDk/VpJrg0QaHo30yho+fOJLWRFUM/qon+rxwDHQ0C57VWAkiQFCTIgmcJ3UQ1YQUbgdkMeIJqa2LVRzmZfEX8fbz58nMz0trQ2Xpy0k= Received: from localhost.localdomain (2001:4898:80e8:8::166) by BN6PR21MB0146.namprd21.prod.outlook.com (10.173.199.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.156.0; Fri, 13 Oct 2017 18:20:25 +0000 To: qemu-devel@nongnu.org Date: Fri, 13 Oct 2017 11:19:13 -0700 Message-Id: <20171013181913.7556-1-Andrew.Baumann@microsoft.com> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 X-Originating-IP: [2001:4898:80e8:8::166] X-ClientProxiedBy: CY4PR16CA0031.namprd16.prod.outlook.com (10.171.216.18) To BN6PR21MB0146.namprd21.prod.outlook.com (10.173.199.148) X-MS-Office365-Filtering-Correlation-Id: ea50e83d-bdc1-451d-3aa5-08d51267137f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(48565401081)(2017052603217)(201703131423075)(201703031133081)(201702281549075); SRVR:BN6PR21MB0146; X-Microsoft-Exchange-Diagnostics: 1; BN6PR21MB0146; 3:GDTeiYxRty445ITngcpYL1YlTwxlI/G24TDcWh3U60ZnHNbs2CW7Z5gwRu5H2AUZChAeHo347WIxcU4v+QSqETeQbVmFkT19WfakBC2FvTR31iYzJgqUrU6CYTfO488aqMGHASKFtGdhndlqD1p4h+MW+hLw+SI6Z0BjA5TuOWlaPQ2NdTj7sUx4J3Y4QRiXYaXwhXOmM/GxqSPNQ34PyLEJr1E8DRPGC78IvRJVU7K8D7g4vcFVKCGBMhhtZS7Q; 25:CbTMRzLrh45oqBFhTSvT9DfuGp3bfoFwKsCpzMWflZnAobpJLA+YxYlxFJPa+T5s0dQuL71TEreT/i0F6JtPdxH09oqRtewcuFm265uqjNjBnbMTLWG4fi/IlQovLISCr+1kTz9cbZayh6hHrthFNkA/kI3p1CNwbbq08sKlJhYVSk8gle3dZ3idzezx3RD/KvzkrjwZ1C8H6cJVxo6iXU0emcr5qRJNpBp+xC2g1AtH2A4CsF8eGHfRM5xNXw8YsB+6nIWuxV7UAoxU7fCgOew75K8BLQOixzHGFKZJ/8U00ZoitRFGBU+6XKjmDeyn658kn3R34H7dkTroZ1gDuQ==; 31:u53rbWKf65DiBgqsim4wwCc2PHUyNL8Kz/OL54krX8G3t8qi6ICSk42zh3O8ikLXFoEgWCKbYCv0Gtw26ysiWgUqVLQMRcrIQOBB/QG/us4JahFh6ZBU5uFik3S4MOQ6Yamdq9cGGV071WSuKgHwuLAm/WL9TIGkUtJFnIFr2JK4nL737ePzsrhL+afNQn7A1Ih3ShP1wkoxbvgI6P2JVKAye79bDCHwQ5z+dmmXHCA= X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PR21MB0146: X-Microsoft-Exchange-Diagnostics: 1; BN6PR21MB0146; 20:jv/t6eT3hkbVKn0bbaSC/seO+9dFEGck/STYHMCrzmslMSgJF7OlDVrms6Rmx9sz9IjAPm+rQ/DywJFhkI3VuMbGi+TAscLjlHQCPUpdhFGW1SPR5iSDDR2YqN4pWVTMLktxQ2aSBEO3hTdbfxemzaoeC+EjtyM4Y7vBCt4KkEmE+bsIZHme2eMYOhvnMc6Ipm6dc6OcYK59rVM7XpSjeJ6dfJWU36ZeadIrXarnzMVFMGocq2uEyu/+Sb/dfokWTUjhxZcUHR8rnOml5Q4jz865kpZl5Xqiz2CxYi+UJJTbUhdq3bpztcuFCKIX9RB0FEsrEzgoWP0TIlbhCZC4Regarmwy3RIOvsirAnIlcEdtjxPF6xW0vu8FtqCWuljvrcwBXG2BbfDHqkVa3THXQRHyq0etwgf+lfiAxXG5IGgjQkK6Q3+UH3hktBbQLrzCoGuOdPjV3nxWkvY/QkFPzjDAHhGD93VgSIdOzy/0H00vcZdXa+zjHtVgwrAaB9wA; 4:PRKNTsDCRL6tCU1MJTf+4gbfD2r9Et5VVmJJ6XKopWqApVfYY4FKwSgPcmWJ/2PR2UDhDG0IW8zDK6MMP1A4zIwLQeE+K386BjT+a1iffS00jRSd4D8NOUI05Uzo5dIhCI0O+DOlZLAIa8JC/yEyhj92VVfLNABB89p9q2sjEEQyLTWBz+E9175TyTOlPU/Sr6hdvV8xZs/7gJbSBw6o9nyQQDBCnGn43OTd7EbCUS46Sg0uP4tEmYUp/zx7TZIOCX2NaPKVcx6x+kBQvczH0HIB2+gfI2nKfpts4Ue6LAc= X-Exchange-Antispam-Report-Test: UriScan:(89211679590171); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(61425038)(6040450)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(61426038)(61427038)(6041248)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR21MB0146; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR21MB0146; X-Forefront-PRVS: 04599F3534 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(6069001)(376002)(39860400002)(346002)(47760400005)(199003)(189002)(101416001)(4326008)(50986999)(106356001)(72206003)(39060400002)(6486002)(2361001)(478600001)(2351001)(105586002)(25786009)(6506006)(8936002)(8676002)(81166006)(22452003)(36756003)(81156014)(6116002)(16586007)(316002)(54906003)(1076002)(7736002)(305945005)(68736007)(50226002)(10290500003)(48376002)(47776003)(86612001)(97736004)(6512007)(189998001)(107886003)(6916009)(86362001)(53936002)(5660300001)(2906002)(6666003)(5003940100001)(50466002)(10090500001)(22906009); DIR:OUT; SFP:1102; SCL:1; SRVR:BN6PR21MB0146; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Andrew.Baumann@microsoft.com; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR21MB0146; 23:A7nBkbHFRMJG2+7jRiw+/B4edAMuNl10xel+BmStE?= =?us-ascii?Q?dxumL0ExbKsClZlq/sN5XbyhWtyqUEvRJd1gYwXDvzOpxkJBSOAvUe9qAfww?= =?us-ascii?Q?dMky5POGYpimRaZ0hYc24YSUMUfuLI5iyNpH3jAzRybAcPUOHcErb//xtQuA?= =?us-ascii?Q?k3OvGHV4izcJil6I4eR229nbSH3+JUx36WEPEChN/PBOlJAv2g3V4x9GyXEU?= =?us-ascii?Q?89TgUEh3YBICwgD32Xh1ev2vNMnJPfp1Mkj4YnZTj4FQWm2nRQNZL2lzmBsy?= =?us-ascii?Q?fCIJlVrd370o921XiG2OWIG1h/EZJ9iRLYCbnlBHzQ6C6EyEtP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Ao1MaF9Fahg02cnJe6UuzHPkc63JXSMkb?= =?us-ascii?Q?/2B7KJPdpZt/E0WckOioa/GYWrD9QS0G2j+4eVs?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR21MB0146; 6:FJoYarczYIYC8DngIkhgVOYNlUVjiPbbwfloodsY3+Y+yI9azgUxynxs9hLg8pVA61jN5kKOHev1EdWK5dTbtlLYgC1KPQXIQCfRcHr8Wk4f6wcJmlX5xWtU5SV5fU/FwE0uBnUoy4LhPQI1vT+kxNnDwZo0L+QkJ9fTIpUUN71l0do3f15eqyEvAz4i7SkTAbTQBuYzLE7QmsJKZxMIJFnhpo91UuKREoqvtcHWW0V4GaYkPmo3qO1C4IXbnM6lg5H/Oc+MN0FJb/TZcVi2byOsErlZiPxGoJ4jjlKVBSj6joXNq/rKFQuDM4+TrVbbmgQOoXrQDGtiPpPQi2FxZg==; 5:1wimdWrwdyCgyS5cYLk6tOgs9nPUHu5ZdbmI2SaJYC20PN7pWDJmc5Jdab4cpPVwTWy/qHkvRQExmLYlU8siSt4gQ+ol80IdQ9YhK9gE7rUMLXnUDMJ23nBjkqhnAWCp4IMGAdxC3EBTr2OY6BUfPw==; 24:X3Yx+uYOeppVo42bDoyb+ORkW/Qwmq830dPbwNFP/AANWa7rpUU77zMCASeFfZq4yBmwmQfIDhDNp2slxJHi25rJzxDLuIVAiW4zeKxvcVg=; 7:xsx1E08XuN8vkFczdTvn6pUvvKs+81V7+Fn/mEuqpOaOXxj2XEm7oY+fL8hg/qtrHWTqdxgHfeWPdyxx7UkSHVvh4v73Vy8TazwP5bpkbhRuqNJGEbLBB5i5Qiy1m+um3YGvPFU4ylGlUPqamCxzzQa0ob3veZZP5hsqmmshnKEtmyLDY4oeKyf9c8PL55AHf1Hpyp0W4Nifgigt4ABEktm9viwD1ep+qGrko8oHdGg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2017 18:20:25.5435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea50e83d-bdc1-451d-3aa5-08d51267137f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR21MB0146 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.115 Subject: [Qemu-devel] [PATCH] notdirty_mem_write: implement 8-byte accesses 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: , X-Patchwork-Original-From: Andrew Baumann via Qemu-devel From: "Denis V. Lunev\" via" Reply-To: Andrew Baumann Cc: Paolo Bonzini , Richard Henderson , Andrew Baumann , Peter Crosthwaite Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Aligned 8-byte memory writes by a 64-bit target on a 64-bit host should always turn into atomic 8-byte writes on the host, however if we missed in the softmmu, and the TLB line was marked as not dirty, then we would end up tearing the 8-byte write into two 4-byte writes in access_with_adjusted_size(). Signed-off-by: Andrew Baumann Reviewed-by: Richard Henderson --- This manifested as a race in lock-free synchronisation with an aarch64 Windows guest on an x86-64 host (with multithreaded TCG). exec.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/exec.c b/exec.c index 6378714a2b..7c591a9b75 100644 --- a/exec.c +++ b/exec.c @@ -2348,6 +2348,9 @@ static void notdirty_mem_write(void *opaque, hwaddr ram_addr, case 4: stl_p(qemu_map_ram_ptr(NULL, ram_addr), val); break; + case 8: + stq_p(qemu_map_ram_ptr(NULL, ram_addr), val); + break; default: abort(); } @@ -2378,6 +2381,16 @@ static const MemoryRegionOps notdirty_mem_ops = { .write = notdirty_mem_write, .valid.accepts = notdirty_mem_accepts, .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, + .impl = { + .min_access_size = 1, + .max_access_size = 8, + .unaligned = false, + }, }; /* Generate a debug exception if a watchpoint has been hit. */