Received: by 10.223.185.116 with SMTP id b49csp3910863wrg; Tue, 6 Mar 2018 07:01:40 -0800 (PST) X-Google-Smtp-Source: AG47ELs1bceXPYkstpUlXTQTwHy4GJhj3W0gEFz1HiVDKjLYybkhUm9CW+xoqD/icJJLeysLFL7P X-Received: by 10.99.152.10 with SMTP id q10mr10031025pgd.62.1520348500123; Tue, 06 Mar 2018 07:01:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520348500; cv=none; d=google.com; s=arc-20160816; b=pFAH6GMHwc7CY7Cch9VXsxPJTVp5MaLXxZptJzOOuQY5DKC52HMuX0a4LC9fvpjmCb KQR+iY3454LxjecVIXtzFwGNsNbicG1NjMiEDpjD5Z1mBEVbXtFnL1Q9T6Tdo1iaDm9r 1W6vZoWEk1f2Gn+bCLdO+aCADype/EVyh5j+UQlPIsMwxvYMXDxKzD/yPmnoC0EslHA8 llrM4+fokgUxUEAXIB1dW8IfcYB7Y1cThzsPn8oL0L8LuY6NykNwYKxL8G5CuAAWw1ir K0nymJbd+wpN+uiRnWkx4LLsWdJn8uCkcqzVZ4/T6j0VKvY7dmvAWeEGV6LdOI9j3+GY bvWQ== 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:arc-authentication-results; bh=9l7PB72LJ2D1uv/qM1sxFJeGgqwHu3fueMhqe7rfDKg=; b=hgeO0vD2f0vaqpxDqKiQORXgknbXpkN/V1bi0wvhleFsc9oDuVWJKrMx2LCdMX5bZD bzl2PYFLxqVdhqoQxlL6J+0Zyr4HmAhwAz+L4n0e5uVGwtypwDJLAgluyziedZhTPy5s AYOl3EQzuKdaE9nI+m1Ybx3fXUyxHGbyOjnQSf8TCChVDwyq0y8zGS6Lm3sPjJvTpK07 m1y5BvO+zMLdknaKEcJvDctfrj5RDH0BnEeoDH9HD8Lgi1WfwjmcQ4bhOcn8ObNaNUBd yB7VWpTE/sZ04iphCIEYmhIFEgN1vzkUGnMdXL0WGOp/fcJnVvyhZXnWc34ilPXguGSJ ZMdA== ARC-Authentication-Results: i=1; mx.google.com; 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 w1si3599485pgq.135.2018.03.06.07.01.23; Tue, 06 Mar 2018 07:01:40 -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; 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 S1753790AbeCFO6L (ORCPT + 99 others); Tue, 6 Mar 2018 09:58:11 -0500 Received: from mga02.intel.com ([134.134.136.20]:50405 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753762AbeCFO6K (ORCPT ); Tue, 6 Mar 2018 09:58:10 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Mar 2018 06:58:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,431,1515484800"; d="scan'208";a="35033900" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga004.fm.intel.com with ESMTP; 06 Mar 2018 06:58:07 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id A83D4193; Tue, 6 Mar 2018 16:58:06 +0200 (EET) Date: Tue, 6 Mar 2018 17:58:06 +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 21/22] x86/mm: Introduce page_keyid() and page_encrypted() Message-ID: <20180306145806.ejg5kzaqqmncgqi7@black.fi.intel.com> References: <20180305162610.37510-1-kirill.shutemov@linux.intel.com> <20180305162610.37510-22-kirill.shutemov@linux.intel.com> <61041640-435e-1a67-177f-a75791130514@intel.com> <20180306085751.tvozsfe6hogh37pd@node.shutemov.name> <91d27559-3f28-d53c-9fd9-d16e015a3f59@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91d27559-3f28-d53c-9fd9-d16e015a3f59@intel.com> User-Agent: NeoMutt/20170714-126-deb55f (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 06, 2018 at 02:56:08PM +0000, Dave Hansen wrote: > On 03/06/2018 12:57 AM, Kirill A. Shutemov wrote: > > On Mon, Mar 05, 2018 at 09:08:53AM -0800, Dave Hansen wrote: > >> On 03/05/2018 08:26 AM, Kirill A. Shutemov wrote: > >>> +static inline bool page_encrypted(struct page *page) > >>> +{ > >>> + /* All pages with non-zero KeyID are encrypted */ > >>> + return page_keyid(page) != 0; > >>> +} > >> > >> Is this true? I thought there was a KEYID_NO_ENCRYPT "Do not encrypt > >> memory when this KeyID is in use." Is that really only limited to key 0. > > > > Well, it depends on what we mean by "encrypted". For memory management > > pruposes we care if the page is encrypted with KeyID different from > > default one. All pages with non-default KeyID threated the same by memory > > management. > > Doesn't it really mean "am I able to use the direct map to get this > page's contents?" Yes. Any proposal for better helper name? -- Kirill A. Shutemov