Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5607328imm; Mon, 23 Jul 2018 02:49:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeupYLtnWz27M4MtVKUiGrgxRVnO0/UOEkzgb3Efw63m/yYqYB8ayKQMgemYT1V/kq43pTU X-Received: by 2002:a63:1262:: with SMTP id 34-v6mr11801626pgs.154.1532339354534; Mon, 23 Jul 2018 02:49:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532339354; cv=none; d=google.com; s=arc-20160816; b=dD9rjGnrrn0rlwa8N3pgTO45VB9YvlaHj0zM1YcsYzF60GTsBRUKUnyiLhRpimhTUg RAcbcxf8ClgbKA6RlmWVRISg+ebUpWsDDy3sw7zLpFACY1OmozA/oE5zS00Rj00tG8L1 pOmpGWZM9h9rnzx3Mj9wj50vrk9b9tzxEUjRq608D3uaAtXFSTPqWrtVcnlBQXHU3E7B uvPBLMX3sfjggWCGdHxy8LGrDozs30bYvAh24UCuHq70M0eSrfSWCfcqrLJF2oWQUVlG iXIJsinF56Y6DWt7iEUKIEq5xV6mZ2jtN1ZSx8eoJ03x1lujHSKXQ0qDvXKrDxc4vNf/ ijHw== 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=VjCdVT72yGyZRDBZIu7vDGiE5k+3qldmoPrCopkGq1w=; b=p3H5ZH3yUo7DmmkQ89G3OCuAoKQi/J0ITLJCJM/yvbn6zkWyJYN0yQSr1RsFDFZKY0 CCz36ESgNTf9keRFPW4dbDeEYONBZiFsJ3OSqYciH3DM7WTu9ShZeiwXy5lWaz5c2wpg jUoqtaGLfD+3zDaWXH7GC54/841cmnAXfmOasEEuzyYTUibMWqIGERMQfMBKhuy2grR8 Cn6SEjLZSjszx4Na+ZSvLKz0TO2LkuePwCyZOgR3IwL2kn1XSIedWWy8DTHM590NnEGa SnCQaqSvf6mrN/SNlNNsJBcKeh+tUljvSOOpBjgJzJgbhKWGEinNAk/L8RpPTSIZs7T2 hd9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b=d2j82Ymg; 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 o11-v6si7511208plk.421.2018.07.23.02.49.00; Mon, 23 Jul 2018 02:49:14 -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=d2j82Ymg; 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 S2388420AbeGWKsN (ORCPT + 99 others); Mon, 23 Jul 2018 06:48:13 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:42492 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388202AbeGWKsM (ORCPT ); Mon, 23 Jul 2018 06:48:12 -0400 Received: by mail-pg1-f196.google.com with SMTP id y4-v6so8173pgp.9 for ; Mon, 23 Jul 2018 02:47:50 -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=VjCdVT72yGyZRDBZIu7vDGiE5k+3qldmoPrCopkGq1w=; b=d2j82Ymg8tT3R49p1Y6KNStMcvFIMfe1myLMu39ktLO/AW9NJ7ur4kik0Pb4xE7/LI GGOO7RmdjfkTKJSTypw/a6itc4hOv2A4pdaxSJM3f56e1SXSWI7vkAfWExLIFB+q4EIG cK/0w3jifpB9/SEV1PaayMdickfw8FToQMLeLS8MzCiMWyUKwmf0QehsYML7P8V45ikq CsVhjCpqmsVd0XLqk3PpdFb1Jd6yOxlpaRRsrvo2K67GzxN+kh/jOdIy3o88Du7zLqzC VGyxcubzMQhCw+Otjpv26McVzfOfVrNZSg8O0OILAmUHXZlwK34ZoWW5YdG/FYZiSb6z 9dyg== 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=VjCdVT72yGyZRDBZIu7vDGiE5k+3qldmoPrCopkGq1w=; b=AjFFdMS9ESKp+XgeJVNmlTfnUguy5yOr7IuOkT1Oe+4P6JH7M4c4bbxRoMXBuzprBx efrGc5MoX/enJV0Zi4a4XhI56wcFHbVJB0XXnHruGLpqdN9f4uRMd+lnei8dpidriqkD e/Hq90knCJsuTYL4ogn9kES/aKa5ySUM/qdvoWbJWSo4rN/kwRfPDiTjIPk8rVsUPplT L5ewslQpDNlUZcFfOxdwQ91ECiF5jtYjkeHw8SO1KUJpc5WWF2EshCSjcCPBkOgxlGyd /6xAaTcT2VA0e4gGdD73iox/q+/5GipPNgIN73UOgRRfoMN2NYuZbpcz1Zet1nklpb9l 8jdA== X-Gm-Message-State: AOUpUlFk+/Vixm3uMXeHBj5cwDAlxJXWupeshyVRwn+crvB5TTBwc2HC fjq+a7pScBblW8o1eTNlVLpBpw== X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr11207534pgo.403.1532339270602; Mon, 23 Jul 2018 02:47:50 -0700 (PDT) Received: from kshutemo-mobl1.localdomain ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id 8-v6sm12795393pfk.132.2018.07.23.02.47.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jul 2018 02:47:49 -0700 (PDT) Received: by kshutemo-mobl1.localdomain (Postfix, from userid 1000) id 4F2EA303A0F; Mon, 23 Jul 2018 12:47:46 +0300 (+03) Date: Mon, 23 Jul 2018 12:47:46 +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 Subject: Re: [PATCHv5 11/19] x86/mm: Implement vma_keyid() Message-ID: <20180723094746.447v2jnegqlosi2f@kshutemo-mobl1> References: <20180717112029.42378-1-kirill.shutemov@linux.intel.com> <20180717112029.42378-12-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/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:40:14PM -0700, Dave Hansen wrote: > > --- a/arch/x86/mm/mktme.c > > +++ b/arch/x86/mm/mktme.c > > @@ -1,3 +1,4 @@ > > +#include > > #include > > > > phys_addr_t mktme_keyid_mask; > > @@ -37,3 +38,14 @@ struct page_ext_operations page_mktme_ops = { > > .need = need_page_mktme, > > .init = init_page_mktme, > > }; > > + > > +int vma_keyid(struct vm_area_struct *vma) > > +{ > > + pgprotval_t prot; > > + > > + if (!mktme_enabled()) > > + return 0; > > + > > + prot = pgprot_val(vma->vm_page_prot); > > + return (prot & mktme_keyid_mask) >> mktme_keyid_shift; > > +} > > I'm a bit surprised this isn't inlined. Not that function calls are > expensive, but we *could* entirely avoid them using the normal pattern of: > > // In the header: > static inline vma_keyid(...) > { > if (!mktme_enabled()) > return 0; > > return __vma_keyid(...); // <- the .c file version > } Okay. I'll do this. But it would be a macros. gets included very early. We cannot really use jump label code there directly. -- Kirill A. Shutemov