Received: by 10.223.185.116 with SMTP id b49csp3546733wrg; Tue, 6 Mar 2018 00:31:42 -0800 (PST) X-Google-Smtp-Source: AG47ELtHvfgXkv9kw62R2dq/u5uSwT92Rt+FRPEWrC+0QHygWo4mJ+p5o4CF81N0SzGGsXpdF1wz X-Received: by 2002:a17:902:7485:: with SMTP id h5-v6mr16341212pll.236.1520325102589; Tue, 06 Mar 2018 00:31:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520325102; cv=none; d=google.com; s=arc-20160816; b=UUIo5FyjR3NSBgO/ix/IeYmkQn8ShOAZyeVDfmnaqaFmTUdt09wlpYLV50+Fe2hHF7 WYq33Gi2vjHbALgEo7Bi806qu9b1dSR1YToRY3/jZjtnbDdNGAxZO8y1K0bkBmhZRGHf +B+xkZv56L4kCO9L9rejtQWFFF1wBFHBRaby91vELQs6xCMzN/NSKMW+Xm55avsWusaz HEAxWIKvgcw1hWQMIZ9CZVpHFg4c/bpPXGTe6K2CoGf+vwoMznCGrWSC6oQ4kn9d0UO7 /ZNeDkVTnZxjUm4zkpKQ2UZLW0Nj8SFBUXhFqEJo7CmMGxg6fPySYKD2xnpZjZO+F5Nn pamw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ra6aQ2bkbbs1HsjGmVsu7DWCe2dfuWRRd/kgo+qyI44=; b=EtWXH2gmVD55TSh1Hdmj1ZZzJs/PC5kQM8Q4n1ErTNZ8DhAjn76ZPAKkukIRs5Jbpu ZvBvnRtIwJk/MPiLCLHJveNvd2qUlYwNsZDuYWQKJPkQd69kw8aV6h8ax1mJUWVAsX6j ZnOuKARaKzZ7QE+ylsh0gUtYVxtiF8nSu18sQUkrPmLlpaQc4sds9IabiO45ZM5FmR+2 pNhJKLZpnLqjZ1qYEgL3UId7lxZ5ALY3oQs21TivTpGyJ/nZ/xZ0Bc4rbMTXdS6qteBt 6qitFWOi9r3bI1J8JyxbuZDAgqqDEaDyaj6A2vFVs3795T5WNxm5GuQugMT3rKsEc9ND DA1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=xfkUiOyi; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n19-v6si4336502plp.582.2018.03.06.00.31.27; Tue, 06 Mar 2018 00:31:42 -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=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=xfkUiOyi; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304AbeCFIaa (ORCPT + 99 others); Tue, 6 Mar 2018 03:30:30 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33392 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750817AbeCFIaY (ORCPT ); Tue, 6 Mar 2018 03:30:24 -0500 Received: by mail-wm0-f68.google.com with SMTP id s206so16838159wme.0 for ; Tue, 06 Mar 2018 00:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ra6aQ2bkbbs1HsjGmVsu7DWCe2dfuWRRd/kgo+qyI44=; b=xfkUiOyigis9eFK4Rq0JhyOR6pwN21vS1UR/nckN7nZzYwwInpSEPBe265gQSLMu0t VQoWIwpJ+nLuL0S7vPJPLH74MQoG0ST1nkDP/Chu5CQWrsM5sRfclb+wQt+NHNqe+8vF gT4eSOPacQSi2HwilcrqAZvNrcsLmAmeu+SXkBNOINW4qeVb7tWYzDWSxqNz6/eWaWW4 ivSsxk5IFtWVmKTeCeaQgCj3oaZ/7AjEfBM7EWB/tROQs7tsEzmkCFMZL32Z2Pzx7mr8 tPiZaEqkQ9qVN54+k8LJBM+xGJJdtV9Fgka61aFZ8mnPfIp/1DsuDOZCc7qmno0cKAM+ 0M/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ra6aQ2bkbbs1HsjGmVsu7DWCe2dfuWRRd/kgo+qyI44=; b=XyuNuHzG35g45IWdBUYtGgY+fukj1KTTYsssDzUqEmlaZVmLtuVVzfuSrzvahE6hVV 1XcDQYZBeq6MPtqSm6oEqEELNn9JZgyZlqzSGtOsrREp2/HQyXTddi4Q2rG/gLe71pK0 I9ecfUazoDe5+WRJb/4XunHo+SF+s1caofa669cjeNTgwCo1ggtZnhOb4Yzhsce2357C B79IR4QXINQEDbo7hh7VtNL+fQBKqIAB4+Lr6MgNVoA7jPhCF/Lena0v3qiPaC0G6P4F g4gqLVerFIluMVrWZlfj0Z65r7ma2CcBOFEpIv7jp61YrEsIlRAnnhNkOXtRpoHBxGcf Ro3g== X-Gm-Message-State: AElRT7EiH1QKCt5nLLlG/LPztwuGeXmlIeKZWorFD3B5E0FpOE49wOis thVwTCA9s+z3w9UdZm7ppDYJbQ== X-Received: by 10.80.217.136 with SMTP id w8mr12779078edj.193.1520325023535; Tue, 06 Mar 2018 00:30:23 -0800 (PST) Received: from node.shutemov.name ([86.57.210.234]) by smtp.gmail.com with ESMTPSA id f6sm13201980edl.9.2018.03.06.00.30.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 00:30:22 -0800 (PST) Received: by node.shutemov.name (Postfix, from userid 1000) id 409E7648D520; Tue, 6 Mar 2018 11:30:08 +0300 (+03) Date: Tue, 6 Mar 2018 11:30:08 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky , Kai Huang , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC, PATCH 16/22] x86/mm: Preserve KeyID on pte_modify() and pgprot_modify() Message-ID: <20180306083008.6dklty5oq3pbzxuo@node.shutemov.name> References: <20180305162610.37510-1-kirill.shutemov@linux.intel.com> <20180305162610.37510-17-kirill.shutemov@linux.intel.com> <774c1251-46d9-534e-24c2-ca04f1e0a8bb@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <774c1251-46d9-534e-24c2-ca04f1e0a8bb@intel.com> User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 05, 2018 at 11:09:23AM -0800, Dave Hansen wrote: > On 03/05/2018 08:26 AM, Kirill A. Shutemov wrote: > > + * It includes full range of PFN bits regardless if they were claimed for KeyID > > + * or not: we want to preserve KeyID on pte_modify() and pgprot_modify(). > > */ > > -#define _PAGE_CHG_MASK (PTE_PFN_MASK | _PAGE_PCD | _PAGE_PWT | \ > > +#define PTE_PFN_MASK_MAX \ > > + (((signed long)PAGE_MASK) & ((1UL << __PHYSICAL_MASK_SHIFT) - 1)) > > +#define _PAGE_CHG_MASK (PTE_PFN_MASK_MAX | _PAGE_PCD | _PAGE_PWT | \ > > _PAGE_SPECIAL | _PAGE_ACCESSED | _PAGE_DIRTY | \ > > _PAGE_SOFT_DIRTY) > > Is there a way to make this: > > #define _PAGE_CHG_MASK (PTE_PFN_MASK | PTE_KEY_MASK...? | _PAGE_PCD | > > That would be a lot more understandable. Yes, it would. But it means we will have *two* variables referenced from _PAGE_CHG_MASK: one for PTE_PFN_MASK and one for PTE_KEY_MASK as both of them are dynamic. With this patch we would get rid of both of them. I'll update the description. -- Kirill A. Shutemov