From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA091C433DB for ; Tue, 26 Jan 2021 10:24:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5ED521744 for ; Tue, 26 Jan 2021 10:24:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5ED521744 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=alien8.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F2FDF8D00BF; Tue, 26 Jan 2021 05:24:11 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EE0278D00B0; Tue, 26 Jan 2021 05:24:11 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF6548D00BF; Tue, 26 Jan 2021 05:24:11 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0239.hostedemail.com [216.40.44.239]) by kanga.kvack.org (Postfix) with ESMTP id C8CA98D00B0 for ; Tue, 26 Jan 2021 05:24:11 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 709C71EE6 for ; Tue, 26 Jan 2021 10:24:11 +0000 (UTC) X-FDA: 77747541102.04.cakes58_2f0a5142758d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 4E325800A333 for ; Tue, 26 Jan 2021 10:24:11 +0000 (UTC) X-HE-Tag: cakes58_2f0a5142758d X-Filterd-Recvd-Size: 3675 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 10:24:10 +0000 (UTC) Received: from zn.tnic (p200300ec2f0d1100bcf83db545f09974.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:1100:bcf8:3db5:45f0:9974]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id CB2CF1EC04DE; Tue, 26 Jan 2021 11:24:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1611656648; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=gmVhkBSNYh2tQM3hLJDqtgcOU5M+oLAy/Q1t/J7w2Gk=; b=FbU5kNmHpPusFNCpBVV5pBGxok6dOmS9QwJ6bVkKdPfT7PHs705uVSTLAyXV8gGzlJ8ux6 gUOiHGr/iUmtLqd1K9d8Y+Nk80FL78ISu5YOtpOcY0Tc8Zmt0wPfsOsYp34A402Kxg9lZA GWVwADHhKN+WmOmtyVVFjcQe2CSNW4o= Date: Tue, 26 Jan 2021 11:24:04 +0100 From: Borislav Petkov To: "Yu, Yu-cheng" Cc: x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-api@vger.kernel.org, Arnd Bergmann , Andy Lutomirski , Balbir Singh , Cyrill Gorcunov , Dave Hansen , Eugene Syromiatnikov , Florian Weimer , "H.J. Lu" , Jann Horn , Jonathan Corbet , Kees Cook , Mike Kravetz , Nadav Amit , Oleg Nesterov , Pavel Machek , Peter Zijlstra , Randy Dunlap , "Ravi V. Shankar" , Vedvyas Shanbhogue , Dave Martin , Weijiang Yang , Pengfei Xu Subject: Re: [PATCH v17 11/26] x86/mm: Update ptep_set_wrprotect() and pmdp_set_wrprotect() for transition from _PAGE_DIRTY to _PAGE_COW Message-ID: <20210126102404.GA6514@zn.tnic> References: <20201229213053.16395-1-yu-cheng.yu@intel.com> <20201229213053.16395-12-yu-cheng.yu@intel.com> <20210125182709.GC23290@zn.tnic> <8084836b-4990-90e8-5c9a-97a920f0239e@intel.com> <20210125215558.GK23070@zn.tnic> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jan 25, 2021 at 02:18:37PM -0800, Yu, Yu-cheng wrote: > For example, when a thread reads a W=1, D=0 PTE and before changing it to > W=0,D=0, another thread could have written to the page and the PTE is W=1, > D=1 now. When try_cmpxchg() detects the difference, old_pte is read again. None of that is mentioned in the comment above it and if anything, *that* is what should be explained there - not some guarantee about some processors which doesn't even apply here. Also, add the fact that try_cmpxchg() will update old_pte with any modified bits - D=1 for example - when it fails. As Peter just explained to me on IRC. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette