Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6046124imm; Mon, 23 Jul 2018 10:26:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcKFd573HxBe5tN2Ztoea6Jp2QHvWbCzVqydAeTXEnFKNPli7SfK55sTXGv2rXs+Kzr4NvT X-Received: by 2002:a63:4a61:: with SMTP id j33-v6mr13060003pgl.436.1532366781101; Mon, 23 Jul 2018 10:26:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532366781; cv=none; d=google.com; s=arc-20160816; b=cu2AaBZYYE74Ru4N8HeQo4G0lFdK01hm9FcQfbpmDio+Uq2oQddD68nIeUZK5NLrCW vVr650EKrcYZknan/UzxYp+OQN7zt0tdiMVcJFvVqBbe66bbhFuU1VWyJQupCCCxSAMo t2WB+gSYrZ7x7B2ApgpiNG30FGDLqunXw32I27Pww/rHko2D3hflX9QYi8Z699m/YRvQ bDsl1REG8GJR6bc0+0WL8F4XgO7lTTWS3vcpnaMF/8DAE0Xgvy2QIhOMSPuEOT4B6qvc Gi/A3BrdN70PLfBkUdNkuZMQvrELXLf/3zwfOq9xalSa/rWOLF+lB3g7h8a+jBOzH7TM zpzw== 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=4E6hnXUqHK9qAJ5hKceFqdFagMJv9HE0Wcx4pVhNk34=; b=qM7XGUqVH08XVg7jxeaR42Au82PuU75MAt1aQdSPZmJJ7mxgKqK+IsqzwXHdnOlJCj sJyuaZEqH5MUDQrbX3p2GcEDQnRCl5dH4AIsSIwZzQ7kwHo7kcPrZ339+jx76DyL7ROi X4/aYPQlaRFMzhUvEFwJWQOXXnzs0rm/wfYSqCo2NM7UQ8WlEbgg9GVj0I3jV5vhlzgM QSdYZPvZ0j+gcIuHusIDVQwsnaikmuErtCjGYnWxwvRQQL4G3uQ7mR2jtFm6bgf28NXW ErU7wPs73No5pP9YpSYUBXO/dLx+5/8vERnguwHqoiSzKX3/hTo1uAzNG3SkVqbntgxE xN/A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9-v6si9321300pgm.659.2018.07.23.10.26.06; Mon, 23 Jul 2018 10:26:21 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388098AbeGWS1P (ORCPT + 99 others); Mon, 23 Jul 2018 14:27:15 -0400 Received: from mga12.intel.com ([192.55.52.136]:59052 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387981AbeGWS1P (ORCPT ); Mon, 23 Jul 2018 14:27:15 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Jul 2018 10:25:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,394,1526367600"; d="scan'208";a="57215986" Received: from alison-desk.jf.intel.com ([10.54.74.53]) by fmsmga008.fm.intel.com with ESMTP; 23 Jul 2018 10:25:01 -0700 Date: Mon, 23 Jul 2018 10:22:49 -0700 From: Alison Schofield To: "Kirill A. Shutemov" Cc: Dave Hansen , "Kirill A. Shutemov" , Ingo Molnar , x86@kernel.org, Thomas Gleixner , "H. Peter Anvin" , Tom Lendacky , Kai Huang , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv5 10/19] x86/mm: Implement page_keyid() using page_ext Message-ID: <20180723172249.GA13530@alison-desk.jf.intel.com> References: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> <20180717112029.42378-11-kirill.shutemov@linux.intel.com> <2166be55-3491-f620-5eb0-6f671a53645f@intel.com> <20180723094517.7sxt62p3h75htppw@kshutemo-mobl1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180723094517.7sxt62p3h75htppw@kshutemo-mobl1> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 23, 2018 at 12:45:17PM +0300, Kirill A. Shutemov wrote: > On Wed, Jul 18, 2018 at 04:38:02PM -0700, Dave Hansen wrote: > > On 07/17/2018 04:20 AM, Kirill A. Shutemov wrote: > > > Store KeyID in bits 31:16 of extended page flags. These bits are unused. > > > > I'd love a two sentence remind of what page_ext is and why you chose to > > use it. Yes, you need this. No, not everybody that you want to review > > this patch set knows what it is or why you chose it. > > Okay. > > > > page_keyid() returns zero until page_ext is ready. > > > > Is there any implication of this? Or does it not matter because we > > don't run userspace until after page_ext initialization is done? > > It matters in sense that we shouldn't reference page_ext before it's > initialized otherwise we will get garbage and crash. > > > > page_ext initializer enables static branch to indicate that > > > > "enables a static branch" > > > > > page_keyid() can use page_ext. The same static branch will gate MKTME > > > readiness in general. > > > > Can you elaborate on this a bit? It would also be a nice place to hint > > to the folks working hard on the APIs to ensure she checks this. > > Okay. At API init time we can check if (MKTME_ENABLED && mktme_nr_keyids > 0) Sounds like this is another dependency we need to check and 'wait' on? It happens after MKTME_ENABLED is set? Let me know. > > > > We don't yet set KeyID for the page. It will come in the following > > > patch that implements prep_encrypted_page(). All pages have KeyID-0 for > > > now. > > > > It also wouldn't hurt to mention why you don't use an X86_FEATURE_* for > > this rather than an explicit static branch. I'm sure the x86 > > maintainers will be curious. > > Sure. > > -- > Kirill A. Shutemov