Received: by 10.213.65.68 with SMTP id h4csp1488618imn; Thu, 29 Mar 2018 05:45:42 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+zUU2NcLw86r+CSgcZae/T42Gl/bxigb0NUQycwqCfSR+f5sPk4hDj08lOlWC6bKETFZnq X-Received: by 10.98.171.25 with SMTP id p25mr6271054pff.227.1522327542878; Thu, 29 Mar 2018 05:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522327542; cv=none; d=google.com; s=arc-20160816; b=sOkkBcItw5hRdMrGn4jQeN/gxh/pXhg9pfOLE9NvwHtDYN6zsn1RdDjE/YWSZ9NW1n 8pN81Ne09gZF+zTl7Tv17iHI67zSkA7NFjSTicn2v7hOWx6GNlBPFrx0MRXPMwancdaT eHL33OcLNpGGzN257XbizHk+a91artC0uEhQKHtaw/iLbWvV/DaLMYw7p3uMijWwUSo8 Kh4eJ9gO8ys22vEK7CkQioj0mrqBdE8JgHL0BoFNZjbPPcdNDXsYGCeDKZdlYdyvN0A9 9cwgm2LZH8n3HsldS5bV/lvQz2CcaYz7ofKPprwg1d+VOGXhQkEgbhKHxQzDC3MyrR/v zi+A== 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=B+n9TExQWBn5LLU7oqvDrltdkycFJ3hxdjdgfDNYVCk=; b=u2f58ftubru7El+3gYfSoQ4fRCgEAcCJm84M1nSDdzzGZbF1tEXZNlATT+GKeW2jeX E7nHREcouQ+7Knmm1k6mbhReC3v6rkHAmxBAJ03+bp+z5VQqnjdme9NCmJeixA/5knpq /F573guyXXRifmowHRSnWwEcmryhQSV37EyB9xN9KHx4rYRXmKkLIF5aIA63DcKU7YuX fIWB5gtdEaMwvc0WXQaGCQqqT7Ku7GpkGir3d/nNd0U5B91nKq994h6tQLBUuR3+Z6IP py6f6F6iFfpsxt8iJnsWEbrtz66g+k3F8S3+rj6wNQZ80w8CdLyv3L45hO+34oJn14Fo Obdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=IwW+GJT7; 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 e32-v6si5931698plb.135.2018.03.29.05.45.27; Thu, 29 Mar 2018 05:45:42 -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=IwW+GJT7; 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 S1752278AbeC2MoR (ORCPT + 99 others); Thu, 29 Mar 2018 08:44:17 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35968 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbeC2MoP (ORCPT ); Thu, 29 Mar 2018 08:44:15 -0400 Received: by mail-wm0-f66.google.com with SMTP id x82so11359056wmg.1 for ; Thu, 29 Mar 2018 05:44:15 -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=B+n9TExQWBn5LLU7oqvDrltdkycFJ3hxdjdgfDNYVCk=; b=IwW+GJT7XcKjKdnRgX+51eYn6nlgoP6hAENvonBbgtX1xAYIBHnB+oSuv/XLvULDfi h+iTnwuggxOpQLZw5Ufcvw7zje8MUD42afSyTyL/WPbjNzqVcsfdD4yc4qsx0zvKTxQx SKOzmU6paKMaI8woWRxfSGpM6cuCmFJ30O0LcQIv7LqMQfWlmAdDxas5kn7camKTAnHE vip8L+zSWcGlc7CIsPMqo2/Q9pd15sTHEv2XVVHRWyK38IuWWMhQDFS8MhNUJT//FtO0 TtxXlCW1tjAeNgZaK6ODCdaGzraeVK9H9zVCiG+Eh9qjWGgVQ5kG0qwgMbLwGUirdZSZ L0Cw== 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=B+n9TExQWBn5LLU7oqvDrltdkycFJ3hxdjdgfDNYVCk=; b=HF2EkZ5fk34bBXXQcmz4fccE7Ix7T08o+tkWNVK/x1/xTMfVR6xcxWy9RDnssEFaQV efPEs/+WtQPTms8R7GDmosMJA/2XWUHaN1SY04oQyaGPcfZzfb7gfBN3Bn8pwm9EtZES j2WVfl5rhnP+0fE2tbXrP3KvmdFhmksgHQJv4EfQl3HGWst12DgooPqM6QzDaeZNSKew 5UMHWAuA9srYxGHNe1Dkaa59W2JmhTpiiTVVROPXqtgb/wQ2kOyCSr/IcRY3JSIHZZ/R 6cC2p5bKJMLSPImjJhZDxql9gOYGkUfEjR4GcxmfqSTYsGj4+TRs29OnmWmtEgtyUXN2 ExOQ== X-Gm-Message-State: AElRT7F6oCeWPFkoT4f4j57hvPdH+cOymyXgpJPja0wkhzP6VpkAfq3d PdlsCOzVMXTe2d/eEWUvrMZ/ig== X-Received: by 10.80.242.138 with SMTP id f10mr7199577edm.98.1522327454792; Thu, 29 Mar 2018 05:44:14 -0700 (PDT) Received: from node.shutemov.name ([178.124.220.81]) by smtp.gmail.com with ESMTPSA id i10sm3839399edl.40.2018.03.29.05.44.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 05:44:13 -0700 (PDT) Received: by node.shutemov.name (Postfix, from userid 1000) id 77F03648D520; Thu, 29 Mar 2018 15:43:38 +0300 (+03) Date: Thu, 29 Mar 2018 15:43:38 +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: [PATCHv2 12/14] x86/mm: Implement page_keyid() using page_ext Message-ID: <20180329124338.vxzjpkz3ecyor5uc@node.shutemov.name> References: <20180328165540.648-1-kirill.shutemov@linux.intel.com> <20180328165540.648-13-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180223 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 28, 2018 at 09:59:23AM -0700, Dave Hansen wrote: > On 03/28/2018 09:55 AM, Kirill A. Shutemov wrote: > > +static inline int page_keyid(struct page *page) > > +{ > > + if (!mktme_nr_keyids) > > + return 0; > > + > > + return lookup_page_ext(page)->keyid; > > +} > > This doesn't look very optimized. Don't we normally try to use > X86_FEATURE_* for these checks so that we get the runtime patching *and* > compile-time optimizations? I didn't go to micro optimization just yet. I would like to see whole stack functioning first. It doesn't make sense to use cpu_feature_enabledX86_FEATURE_TME) as it would produce false-positives: MKTME enumeration requires MSR read. We may change mktme_nr_keyids check to a static key here. But this is not urgent. -- Kirill A. Shutemov