Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp999603imm; Fri, 22 Jun 2018 08:42:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLRs7sEtixqJkybLWyNn7aqJZ73id3B5U3aLHsys/y744ANJf6nwiX4fCXpE9gvHk3dGLEl X-Received: by 2002:a17:902:2c83:: with SMTP id n3-v6mr2199273plb.211.1529682120649; Fri, 22 Jun 2018 08:42:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529682120; cv=none; d=google.com; s=arc-20160816; b=Rn2mg4dAzHBlDoYL4HMVflxRLULLzw3KhOzyZPfmI3rymieFE1uoAAebHU018N5/I0 a0zfMkJf04HiXMxvWG5hqZqohbDp9nrJ2V7QoioWyxjkln1shJCbrCRnoGTgHFLAuKR1 CTpI54XWqq/KxngxhWXZkPe925dyboDmhdcuAy0cGs1IJNFZFmdilwlCyaSMezYeQY+d FLom7WoPqYzhALAj+CxdkSCNfWpUkjCSV0TNo/oWgDXKqvNsR++QSYFK0t791mL6hKVk eiFeFMvB32ZqsMBFxijc2vKd+Mx/2j5qUz7ZaJJ4g/nZZ+mazqzN75TxdJwwuWAMBad4 JJjA== 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=lnlDL8KwOE0D+rIEGVPWbl7m6OHJWdbiRjBsfosqP9U=; b=xGcuETb0+vs057l4DMuteC9+k+cktc1HxQv7j+qObsDE8mOakNmo3mbC5/gkxhY6Sq I8oDOdEJDcAYOV2d323tNkViTCwHn/bGTM06/FNWBqN+yuGAPMDhiboDkbVgpU03tB+K Y1zwn8o73C9BYzAsjytkAsHIUw5QV5C3YNstbfW/BnUp9zl52+W5KYqbwfsPYM9RxHQH L/xu7sC4W+2Vghw5pBOjpO4N8ikzSfhP+Fvm2R99+cwtH05Xluj0+K/TBjg3tCsoExZB MH9F1030zSXt4uGn2FP6hltLrDa6PU2wiNUZmt5ojDvJf+EOweCr2CcnDIftelvaJcc4 SOGw== 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 y15-v6si6462802pgc.215.2018.06.22.08.41.46; Fri, 22 Jun 2018 08:42:00 -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 S934192AbeFVPkO (ORCPT + 99 others); Fri, 22 Jun 2018 11:40:14 -0400 Received: from mga01.intel.com ([192.55.52.88]:27028 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933938AbeFVPkA (ORCPT ); Fri, 22 Jun 2018 11:40:00 -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 fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2018 08:40:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,257,1526367600"; d="scan'208";a="49761932" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga008.fm.intel.com with ESMTP; 22 Jun 2018 08:39:48 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 2A04B143; Fri, 22 Jun 2018 18:39:50 +0300 (EEST) Date: Fri, 22 Jun 2018 18:39:50 +0300 From: "Kirill A. Shutemov" To: Dave Hansen Cc: 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: [PATCHv3 09/17] x86/mm: Implement page_keyid() using page_ext Message-ID: <20180622153949.sjfdaeax6exfzxx2@black.fi.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> <20180612143915.68065-10-kirill.shutemov@linux.intel.com> <169af1d8-7fb6-5e1a-4f34-0150570018cc@intel.com> <20180618100721.qvm4maovfhxbfoo7@black.fi.intel.com> <7fab87eb-7b6d-6995-b6c6-46c0fd049d2a@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7fab87eb-7b6d-6995-b6c6-46c0fd049d2a@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 Mon, Jun 18, 2018 at 12:54:29PM +0000, Dave Hansen wrote: > On 06/18/2018 03:07 AM, Kirill A. Shutemov wrote: > > On Wed, Jun 13, 2018 at 06:20:10PM +0000, Dave Hansen wrote: > >>> +int page_keyid(const struct page *page) > >>> +{ > >>> + if (mktme_status != MKTME_ENABLED) > >>> + return 0; > >>> + > >>> + return lookup_page_ext(page)->keyid; > >>> +} > >>> +EXPORT_SYMBOL(page_keyid); > >> Please start using a proper X86_FEATURE_* flag for this. It will give > >> you all the fancy static patching that you are missing by doing it this way. > > There's no MKTME CPU feature. > > Right. We have tons of synthetic features that have no basis in the > hardware CPUID feature. I've tried the approach, but it doesn't fit here. We enable MKTME relatively late during boot process -- after page_ext as page_keyid() depends on it. Enabling it earlier would make page_keyid() return garbage. By the time page_ext initialized, CPU features is already handled and setup_force_cpu_cap() doesn't do anything. I've implemented the enabling with static key instead. -- Kirill A. Shutemov