Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1095019imm; Wed, 13 Jun 2018 13:14:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIW7HUyZeWV8CaTyWez8/9p9U9+/unAOMLl2S8uuzYQj00HwbhVe+FuV3KYC472mqVT2GaW X-Received: by 2002:a17:902:650c:: with SMTP id b12-v6mr6648192plk.31.1528920882419; Wed, 13 Jun 2018 13:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528920882; cv=none; d=google.com; s=arc-20160816; b=eYzxz96QN33W7TVNQB0gryy5x/uwu4BVtANTgk+od+FGFS7FU50p4eGocTEP2imQxE rjRo3dv69Y0qtgaq8RFTiT/7+K+XIr/G9/V3xyK1ugU2HMt8c0YpjbBF+k67mh0C3ZKC WdaETOtJE0461LSApdv9ot+QmMvY8X49R/+GdeCCG44M6BkmdpvGa68oCB3j9nY2+mpq owxcej8BjSaUBGNNoS8wZnARYrWRkrk0MHlfPF7IheJN44/wFXJW3WdWeMbLg6FUw7WE UL5oA9qSLUYMk8ETxSICw0x+j0U1kWqy8veQKlJyKcd0EcCTxYo2Y6H56NRuafPsyAZH s60w== 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=jks5SeR8sdyBVorNhTNXBTFPUxfUef9+bqETIisV3LQ=; b=ToUf1gEuMnS5xihZtu1HndW03W99234VgKbrgiSA+rU/DdtN/VUWBIHgXOfGZ9GdUm xDW4WAQKIWd3HkE6zGlOheA9QWbM1LX5pAVrrEiqQFktgQOvNxd81ZecCmPMevGNdePR HhRtDT4hDMdrcL+jKserF7PzJFTapl+0mGAvokOw6J/h1w1bpQ7zy/kSbhUn7MsqvLnd EUrstqlX+EeoClKC/y2H/C4ocMxBa4fb6T54mexDqgWM0qq/bCQTpPa0i4iehvUGJgfi 37Nj+qnzltsEekjP/ojVZoPhULCaP+oeawG78FKOXnRgFqojPEf/NpAd5AQU+XRRWW+h 3x+w== 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 b67-v6si3721430plb.272.2018.06.13.13.14.27; Wed, 13 Jun 2018 13:14: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; 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 S935532AbeFMUOD (ORCPT + 99 others); Wed, 13 Jun 2018 16:14:03 -0400 Received: from mga17.intel.com ([192.55.52.151]:31605 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935335AbeFMUOC (ORCPT ); Wed, 13 Jun 2018 16:14:02 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2018 13:13:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,220,1526367600"; d="scan'208";a="49670053" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 13 Jun 2018 13:13:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1000) id 027D2166; Wed, 13 Jun 2018 23:13:56 +0300 (EEST) Date: Wed, 13 Jun 2018 23:13:56 +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 01/17] mm: Do no merge VMAs with different encryption KeyIDs Message-ID: <20180613201356.cupmlkfllo4ql7hq@black.fi.intel.com> References: <20180612143915.68065-1-kirill.shutemov@linux.intel.com> <20180612143915.68065-2-kirill.shutemov@linux.intel.com> <090170d5-44a7-9bd6-2287-c1f9f87f536f@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <090170d5-44a7-9bd6-2287-c1f9f87f536f@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 Wed, Jun 13, 2018 at 05:45:24PM +0000, Dave Hansen wrote: > On 06/12/2018 07:38 AM, Kirill A. Shutemov wrote: > > VMAs with different KeyID do not mix together. Only VMAs with the same > > KeyID are compatible. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > include/linux/mm.h | 7 +++++++ > > mm/mmap.c | 3 ++- > > 2 files changed, 9 insertions(+), 1 deletion(-) > > > > diff --git a/include/linux/mm.h b/include/linux/mm.h > > index 02a616e2f17d..1c3c15f37ed6 100644 > > --- a/include/linux/mm.h > > +++ b/include/linux/mm.h > > @@ -1492,6 +1492,13 @@ static inline bool vma_is_anonymous(struct vm_area_struct *vma) > > return !vma->vm_ops; > > } > > > > +#ifndef vma_keyid > > +static inline int vma_keyid(struct vm_area_struct *vma) > > +{ > > + return 0; > > +} > > +#endif > > I'm generally not a fan of this #ifdef'ing method. It makes it hard to > figure out who is supposed to define it, and it's also substantially > more fragile in the face of #include ordering. > > I'd much rather see some Kconfig involvement, like > CONFIG_ARCH_HAS_MEM_ENCRYPTION or something. Well, it's matter of taste, I guess. I do prefer per-function #ifdef'ing. It seems more flexible to me. I can rework it if maintainers prefer to see config option instead. -- Kirill A. Shutemov