Received: by 10.223.185.116 with SMTP id b49csp1044798wrg; Fri, 16 Feb 2018 11:23:25 -0800 (PST) X-Google-Smtp-Source: AH8x226u5z+G3+Soqm04w6WE/X56+7wi0B6iGEFSvvnigq5AEAvBDQcE1S1Ad4LJ6hATKrLO7bEv X-Received: by 2002:a17:902:8b88:: with SMTP id ay8-v6mr6808189plb.197.1518809005307; Fri, 16 Feb 2018 11:23:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518809005; cv=none; d=google.com; s=arc-20160816; b=xPL4Q/t54N9+7l/TuyPeNIJnpv1NsdOmF0Fi0p+7Z2fCGJzblE+vEii0izAg3WoYwH g1+6Nw3orUGWx0iisglb6yjQR400uuHAnsxdgQAutkMujeozeTKnOQ34F51OJG/f065T /3XAulo85yb60WyXVsoBQVX+OUnmHq3RxvoJIHcYdv6tVNy453xF09bWQp6vwMCCkQdK Yvb0feNcsh+Bw08tfRjw+J6UaBuj4J+zBpa5uOGPd1V03EJi0C7/SDmKSkkZYiCp/raz VM8fanexcylw3VJxLzKLAIkV1tEdRsw/J6p6HWaTqZ8PNp3mmwlXnvIdjWIJBIGt3p+k t0ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:arc-authentication-results; bh=AtT8vsSrh+j0DIXx1vAM4k0Y0QB9KeeefRIaEnlx6WU=; b=FnpFfCF4nFYhTYcW0CMXfveF6zqO4DhwDG5ayG8ZTEuh1rk2rxDs+eeoLMADuI9IIX 9WnMXT0rJZvMpwaCPs/CLBHmbz/NiIbgWH0Cev14++1y705z7Rd+alq9YiIQRIuGMpj+ PwQBrMtdlmG0tZ/jMUc2lm4X9gKZTXJrFF7Ezo21WTUWJcsu4abRFenCIBrAu1KthZIP dn9kAtUNNfzgLIzG3fjAWrUvcchW3VkhVr98MrsLWpOamUKuQ7myYReHVIZx+9f7AOws +DmmOfrhfpbsYqI5yYMXyiRUGHjxrbRQFd3M90TK413YheDEjDnRQzo9W9526f2wF5is gzDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R4VBZpgq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y2si2201942pgr.167.2018.02.16.11.23.10; Fri, 16 Feb 2018 11:23:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=R4VBZpgq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751321AbeBPS0G (ORCPT + 99 others); Fri, 16 Feb 2018 13:26:06 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:40237 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947AbeBPS0D (ORCPT ); Fri, 16 Feb 2018 13:26:03 -0500 Received: by mail-pl0-f67.google.com with SMTP id g18so2105802plo.7 for ; Fri, 16 Feb 2018 10:26:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AtT8vsSrh+j0DIXx1vAM4k0Y0QB9KeeefRIaEnlx6WU=; b=R4VBZpgqU+UTG4hsn4qLFHLYHJftu3+4EEIWJeo3YoqGfrKxNwwxPUcxsr2cHFPXGI nBISf70Y/zB1hV+08mxeyAo5wbYKY0UI2gO/b/mWs1DEfJEmuP/pXOoc6N1FFLJ79qlT NvtyS5LbhlvssK3x8sOQQRtJtzNJmG7N8IFOz0CcoBMt3DPTWq58gwToJsfukMICzLCx QU8EXryDpytestsnWp7FFLh2xwT4i+X6S/3WR3R8nwBq4Q2FHAwKEW6kvEaqQuTFtzc/ ugQoWekyU8UcvBxAzXxym77nZrRS4nTy3yFnZGATXXCL0ugd99F11AIqu0JamOCR8GlY b5Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=AtT8vsSrh+j0DIXx1vAM4k0Y0QB9KeeefRIaEnlx6WU=; b=GSQYDJ19WOj59sxmwn3P6iIpKBUTILsMyzKxpfG7Y2yNvc+DxJmXWm1gnLGkw6C20h 7v907nHu0wahWHO5x999IMQQgFTrLLxbz1Nt9VVCTJjiDPQuCgzMAkTIOgi2Tsl5hPG8 NRsCeCKfiLwtNwSyhDzcUeGxsf0KnQelx0Dg0C4eX/C/hoAIVOCVc1F+TDY9GhuLPtXO EyvVfZpRrt7Jym/o/X+zbym4B7qoGQfoTQprYKjHlxsYreRrm3LPy9aBbdHn4+128b1N bz/ODgJaJ3oNr2LyXlkuAlWfnMGhOqQJffT8c9Hb8JkXOC+cKGg5Hjh58xTe2qIXlzRV zhyQ== X-Gm-Message-State: APf1xPB6/4iG9x0KkGDDyerACZoaY/0yvkD5/aKLMx6BR2jQ2taVLB/W gxj4lU926eHMzb9hRH8AUo0= X-Received: by 2002:a17:902:183:: with SMTP id b3-v6mr6608293plb.80.1518805563158; Fri, 16 Feb 2018 10:26:03 -0800 (PST) Received: from [10.2.101.129] ([208.91.2.2]) by smtp.gmail.com with ESMTPSA id a3sm21413760pgv.36.2018.02.16.10.26.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 10:26:02 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [PATCH 2/3] x86/mm: introduce __PAGE_KERNEL_GLOBAL From: Nadav Amit In-Reply-To: Date: Fri, 16 Feb 2018 10:25:59 -0800 Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, luto@kernel.org, torvalds@linux-foundation.org, keescook@google.com, hughd@google.com, jgross@suse.com, x86@kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20180215132053.6C9B48C8@viggo.jf.intel.com> <20180215132055.F341C31E@viggo.jf.intel.com> To: Dave Hansen X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dave Hansen wrote: > On 02/16/2018 09:47 AM, Nadav Amit wrote: >>> But, this also means that we now get *no* opportunity to use >>> global pages with PTI, even for data which is shared such as the >>> cpu_entry_area and entry/exit text. >>=20 >> Doesn=E2=80=99t this patch change the kernel behavior when the = =E2=80=9Cnopti=E2=80=9D >> parameter is used? >=20 > I don't think so. It takes the "nopti" behavior and effectively makes > it apply everywhere. So it changes the PTI behavior, not the "nopti" > behavior. >=20 > Maybe it would help to quote the code that you think does this instead > of the description. :) Sorry, I thought it is obvious - so I must be missing something. > +#ifdef CONFIG_PAGE_TABLE_ISOLATION > +#define __PAGE_KERNEL_GLOBAL 0 > +#else > +#define __PAGE_KERNEL_GLOBAL _PAGE_GLOBAL > +#endif ... > --- a/arch/x86/mm/pageattr.c~kpti-no-global-for-kernel-mappings = 2018-02-13 15:17:56.148210060 -0800 > +++ b/arch/x86/mm/pageattr.c 2018-02-13 15:17:56.153210060 -0800 > @@ -593,7 +593,8 @@ try_preserve_large_page(pte_t *kpte, uns > * different bit positions in the two formats. > */ > req_prot =3D pgprot_4k_2_large(req_prot); > - req_prot =3D pgprot_set_on_present(req_prot, _PAGE_GLOBAL | = _PAGE_PSE); > + req_prot =3D pgprot_set_on_present(req_prot, > + __PAGE_KERNEL_GLOBAL | _PAGE_PSE); > req_prot =3D canon_pgprot(req_prot); =46rom these chunks, it seems to me as req_prot will not have the global = bit on when =E2=80=9Cnopti=E2=80=9D parameter is provided. What am I = missing? =20