Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp736724pxu; Fri, 11 Dec 2020 13:04:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyxs5ClZUSb3Mb4uYBHTyQQ1PlNOSpOtO0czAvkZpO3RTFgtrswHblfjhjX6UtRI0vyLXDL X-Received: by 2002:a17:906:2857:: with SMTP id s23mr12400601ejc.218.1607720659440; Fri, 11 Dec 2020 13:04:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607720659; cv=none; d=google.com; s=arc-20160816; b=Nq9XxJawe1cVyyLRWiIBWR0LtAM5WS8srmAcn1tPcyWzF/WBxV3o+vnoW1K+be99Rd +y03zdVagJItJxaa+lL3GrWcUfRLZxn5LNOTmFuOHcJE+GUspjNSv6NoKvO58S3yzHd1 cjFMzET4smTTyKW7A1QnHCQQJHwA7a/4WGJQuGVJSsHSAq5/mXSdqIk8PB2MPofz2KPy vpfr0YceTZaS3ljTqjthNVOSjgSSr51zrMcDrOKQ2IkQhhqIGhmv6hdkBEdm/WN7cCBE 8Okroq8vStHa8bQQDY9HgrB8PWxS9izm7MzscdmyHXi2sOhw6Cj/h9gTSH9lZcsCkx3V YP/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=DMxIl+sUswXky4hhx8cQNgi4k4soKTP3TjDz/GFCjaw=; b=ElyTU9BoTsDUZPQDGsrHUQDVmQJEbFW3f570L1HQEWUGlq3ba5sGeFEsVV7ac5Z4Wd cMk2qmYhSQFW/wyPeNrGY3JfJPgHECPoGamlANEVzZ/x5WKxmoM9PJU0zE9XMLvIW3kN sPQ/E6TAikUGDnkRoBGIyE9jmcH6OlnRBket4/tpZemjt7t7obP5uAN+mvGNEw0TMUoM j27Go8xmG8g67ncoET6QuFniS0vZnPsGQtQWia32ryafPEEbf8oIuhoK9R5IDU6rny6N 5gkKcYwUPYsodZmbX7yzb+OhSpE8d08lTC7B2jOzRVSeVvMD2a3SO5vXrd0G6B4yrHGK Ezbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=iNEHVi15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si5578884edp.96.2020.12.11.13.03.56; Fri, 11 Dec 2020 13:04:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=iNEHVi15; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392695AbgLJRm7 (ORCPT + 99 others); Thu, 10 Dec 2020 12:42:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391065AbgLJRmm (ORCPT ); Thu, 10 Dec 2020 12:42:42 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FECAC0613CF; Thu, 10 Dec 2020 09:42:02 -0800 (PST) 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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