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 1B8D4C433FE for ; Thu, 10 Dec 2020 17:42:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7E07823A33 for ; Thu, 10 Dec 2020 17:42:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7E07823A33 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 C90946B0071; Thu, 10 Dec 2020 12:42:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C691A6B0072; Thu, 10 Dec 2020 12:42:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5A736B0074; Thu, 10 Dec 2020 12:42:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id 9320B6B0071 for ; Thu, 10 Dec 2020 12:42:04 -0500 (EST) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 4702E180AD820 for ; Thu, 10 Dec 2020 17:42:04 +0000 (UTC) X-FDA: 77578090968.12.coast45_0211272273fa Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 08B8118028B93 for ; Thu, 10 Dec 2020 17:42:04 +0000 (UTC) X-HE-Tag: coast45_0211272273fa X-Filterd-Recvd-Size: 3861 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Thu, 10 Dec 2020 17:42:02 +0000 (UTC) Received: from zn.tnic (p200300ec2f0d4100e4701ee3c8ed8bc5.dip0.t-ipconnect.de [IPv6:2003:ec:2f0d:4100:e470:1ee3:c8ed:8bc5]) (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 125411EC054C; Thu, 10 Dec 2020 18:42:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1607622121; 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=DMxIl+sUswXky4hhx8cQNgi4k4soKTP3TjDz/GFCjaw=; b=iNEHVi15kmRdMHYS4OMEd1JmZaUshnKRI5nbl3emQfzm4SnYizyFXY93PnbbSOvoLSYBQV tWyfO3QpKd1baUIDBU1XePAbFK9WwLEWIw0dkN8xvaUtOrrcF5wgzsX1knpxXSRHRO79Ws Ef3HwocPJpikX283wWeE1yYoYmvMiHQ= Date: Thu, 10 Dec 2020 18:41:55 +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 v15 08/26] x86/mm: Introduce _PAGE_COW Message-ID: <20201210174155.GD26529@zn.tnic> References: <20201110162211.9207-1-yu-cheng.yu@intel.com> <20201110162211.9207-9-yu-cheng.yu@intel.com> <20201208175014.GD27920@zn.tnic> <218503f6-eec1-94b0-8404-6f92c55799e3@intel.com> <20201208184727.GF27920@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 Tue, Dec 08, 2020 at 11:24:16AM -0800, Yu, Yu-cheng wrote: > Case (a) is a normal writable data page that has gone through fork(). So it Writable? > has W=0, D=1. But here, the software chooses not to use the D bit, and But it has W=0. So not writable? > instead, W=0, COW=1. So the "new" way of denoting that the page is modified is COW=1 *when* on CET hw. The D=1 bit is still used on the rest thus the two _PAGE_DIRTY_BITS. Am I close? > Case (b) is a normal read-only data page. Since it is read-only, fork() > won't affect it. In __get_user_pages(), a copy of the read-only page is > needed, and the page is duplicated. The software sets COW=1 for the new > copy. That makes more sense. > Thread-A is writing to a writable page, and the page's PTE is becoming W=1, > D=1. In the middle of it, Thread-B is changing the PTE to W=0. Yah, add that to the explanation pls. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette