Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5605532imm; Mon, 23 Jul 2018 02:46:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd7sYzBTfgQQxnsOY+9zp+3Q2/dVqmGqDzS+0kxb4AMUHfLOcnUWKR7SToQkmONYUukKFxv X-Received: by 2002:a63:f804:: with SMTP id n4-v6mr11773150pgh.106.1532339194552; Mon, 23 Jul 2018 02:46:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532339194; cv=none; d=google.com; s=arc-20160816; b=ePRIZ6QaPPDz6WX98Kfv8UmrAYi8866eTJW75ayS1L9h4azqF24fU12qaONmUD772Y 6UOhDp9TVuk5smH2OYrp7vKgHYGqrM1pqh3dMK8tyszNC/Nz04cBbOk8P81mSDHjmxNl KCrdl4J5X6UkRJvJUmomsinPkgVva/IPDDpik/mPB0BWhFHnzD3O/tICDHi8+SU9rMMh 5f5IA/muE5QApN6/Oa+bqZJbKLj4qPPzglMjTm5InjKe+/nTvbBrGIPfl+/DDfMimqpw X4MUHhOlKrNlpNtJZFSjrIk3Qbf1RcDxdHBtQbLagldutDLwgwCJ0o8j3EpqJ2xskFRH 2FlA== 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=M6qB0A6+pCWrjZZHioIRz6UWZMLVYYCaZcd+wTlvNQY=; b=lB4QF3ycmvKy94/7odOIDZvyMV6CXSDJciMuWQPcRDZoYpU1zuHleSm35/XxjiR1Y5 iyNbrRiYerVywk6Szt2SuBbsM7wXbhFseqv7jERF3O5pcBQLgOneQPk/FO7xcf/dNjn0 aMNujg5GmstKip3TPGrC9vmeorb6Lxg0pDPa9ruhyJsLQ1w/2Bh02sNz3T63GEuCizWY MuFy8LI4RjF8aWjwhugk8JV4AoSgh8DjYuPQd2To+YFDAr9WR71ihIbXxhfx6L7elQ6t W/Bw5O0NY7HyXW2L+VNzkAUE0R7bVG4jnT2qJEKeRfWzSIGPhN2GWzxveiCOMe/yIfPV S6/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=pDz9Gi3y; 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 o16-v6si7246994pgv.402.2018.07.23.02.46.20; Mon, 23 Jul 2018 02:46:34 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=pDz9Gi3y; 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 S2388289AbeGWKpv (ORCPT + 99 others); Mon, 23 Jul 2018 06:45:51 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42166 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388190AbeGWKpu (ORCPT ); Mon, 23 Jul 2018 06:45:50 -0400 Received: by mail-pg1-f196.google.com with SMTP id y4-v6so3949pgp.9 for ; Mon, 23 Jul 2018 02:45:29 -0700 (PDT) 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=M6qB0A6+pCWrjZZHioIRz6UWZMLVYYCaZcd+wTlvNQY=; b=pDz9Gi3yO8tZqA8v7sACd7NfuinEGuElOgqvFYvZaw8yTqmRrHGlAtXCJPNsWSPEIJ hQ2dMTAqZfXFody2qHY1Hy0TDvKiGX8eWJIbP8jyWyb/aUm5iM4MyQfgBOPZ35zxihXM S3c6s/P6JzN911SgG2yq7ik6wF5xjLLEQbG9s+x55giWEANYUF7oTZvo4vb/1bb97LKC r4g6gBumQAFbT2eXVTN77/s/2c59Z8G845aVjFTyPUyEVvykt/NvYvXxGw+XesQpzB02 zOxIG/GoYXiFLmJmrZ6cSBqSN8eRLLI8V89TJjMAMwWaPP+iMKfxI/F87Ny66d5b++U/ r53w== 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=M6qB0A6+pCWrjZZHioIRz6UWZMLVYYCaZcd+wTlvNQY=; b=Lqtx6a/WHdbRCrjAyfcvHnrVbQlZ76eUG75TadQBvx509iGJtfumqUWCAW4c4PqOUs BgtFzxzd/FocF8kxz9UHBcsnaKtHp3lU0BMpAvr/b+946JW61kI0RTyoL39qxf3j+Vqj mlWwPXO0lSzxFAC9K1kJ0ro/OQtkOv2ulreGbJQXdThdNdkcNa1EGN23syAfJU4j/qUc B4Zf01TkkZqOFyTPVsOU3vqdQ3wxrvJP+RW8zdRj1cSny+636ijgCwqChK1peWNsgUOq uI2ovpafE21jXARf5X4x8rz4v14GFHSBee0+hZtlaP1V6aXLsmPTUNmCWI/coH9ZxakV ip4A== X-Gm-Message-State: AOUpUlF3Mi2SLfFBKs1rU4LnYFbO3RvtDwuM5y04ba/16L9iRc2DKanu wuByu79RxzR7p5/lslgHkLzI3g== X-Received: by 2002:a63:6243:: with SMTP id w64-v6mr11528234pgb.179.1532339129169; Mon, 23 Jul 2018 02:45:29 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([134.134.139.83]) by smtp.gmail.com with ESMTPSA id l185-v6sm13756492pga.65.2018.07.23.02.45.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 02:45:28 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id DC71C303A0F; Mon, 23 Jul 2018 12:45:17 +0300 (+03) Date: Mon, 23 Jul 2018 12:45:17 +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 , Jacob Pan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, "Schofield, Alison" Subject: Re: [PATCHv5 10/19] x86/mm: Implement page_keyid() using page_ext Message-ID: <20180723094517.7sxt62p3h75htppw@kshutemo-mobl1> References: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> <20180717112029.42378-11-kirill.shutemov@linux.intel.com> <2166be55-3491-f620-5eb0-6f671a53645f@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2166be55-3491-f620-5eb0-6f671a53645f@intel.com> User-Agent: NeoMutt/20180622 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. > > 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