Received: by 10.192.165.148 with SMTP id m20csp4496180imm; Tue, 8 May 2018 09:19:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrO52LSbCEXLjv9Jf4mwKD7wF0KFJ8leoi7EBJgQx6MOBzuOLFxUWHVHZZly/vtSUFtnc/A X-Received: by 2002:a17:902:848e:: with SMTP id c14-v6mr38915331plo.129.1525796380393; Tue, 08 May 2018 09:19:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525796380; cv=none; d=google.com; s=arc-20160816; b=b8rlsoupc47Pzgv+uvNgkwms3icoBdINFBRW0qL5WO72F0cN1JZ0/hxcXtRzXrRwhY xWQxTI8gIj7X4gAQQGI7fj0sjCIHM49xpmCsta2UbMXodzJrIk1yGcYt9Z89TvlwJgwT LTbIpgfanZEcQi1TKsfBkT5iyi2FaIryjsFTgyyHejb+iREBo+EyvKGLmT0h6+dvC9FA IMq6qN19Q5FrpnEs1RPr/oasv8RQI4AUZvEXeQkSnS3uv/bT97Cs2gk152JySuOCpIQ2 N+M/uyEqx+h1mgXy410eV6waW6i8g0842LTJzkPZJl1wkTESMGO8lh3hhogAPnhTOjVQ VwQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=7NDixncgMavVTuk8Yd4HYcI06vNw9rzHpd2uAbHyMck=; b=AdDHObCMHT1BImmLymtpKUahK3eyA55/wpqETORPsVOQFU2aV9UXLO8QlXS2kWWmQ4 ZkiFx97a6S3Qa5TNzDfBHPMfCBxOe3FZD4qKdic6KRiYVTanYldCC9tMhM2Pq/0tOxYT R2pUt2TL/sY/KbTqVrBxssRM5LhE+HUruaTBAe99Gyy0M3McbiHNmqPzJSoCKub0QMaA 6OLXyDOX6CIw8TkUp9104QhFWEJ6ZZvdTjXZ9iWLIN1lMJmCp7pnY28g0pbPGj6RHeRT C3lnBxbmRJ32mbSoPITBx9bryf0t1p2OAcgapfIM86gLR9Y7dAEU/b0TSxL3I3Qv+8eS yYbg== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f75si25933845pfh.90.2018.05.08.09.19.26; Tue, 08 May 2018 09:19:40 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755443AbeEHQSl (ORCPT + 99 others); Tue, 8 May 2018 12:18:41 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38628 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752463AbeEHQSk (ORCPT ); Tue, 8 May 2018 12:18:40 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w48GH52Z118013 for ; Tue, 8 May 2018 12:18:39 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2huf2ugpen-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 08 May 2018 12:18:39 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 May 2018 17:18:37 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 8 May 2018 17:18:33 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w48GIXnq9240956; Tue, 8 May 2018 16:18:33 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7EDC14C04E; Tue, 8 May 2018 17:10:34 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 07F954C040; Tue, 8 May 2018 17:10:33 +0100 (BST) Received: from ram.oc3035372033.ibm.com (unknown [9.85.137.7]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 8 May 2018 17:10:32 +0100 (BST) Date: Tue, 8 May 2018 09:18:28 -0700 From: Ram Pai To: Michael Ellerman Cc: mingo@redhat.com, linuxppc-dev@ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com Subject: Re: [PATCH 2/8] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey Reply-To: Ram Pai References: <20180508145948.9492-1-mpe@ellerman.id.au> <20180508145948.9492-3-mpe@ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180508145948.9492-3-mpe@ellerman.id.au> User-Agent: Mutt/1.5.20 (2009-12-10) X-TM-AS-GCONF: 00 x-cbid: 18050816-0020-0000-0000-0000041A72D6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050816-0021-0000-0000-000042AFADA2 Message-Id: <20180508161828.GA5474@ram.oc3035372033.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-08_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805080156 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 12:59:42AM +1000, Michael Ellerman wrote: > From: Ram Pai > > Currently only 4bits are allocated in the vma flags to hold 16 > keys. This is sufficient for x86. PowerPC supports 32 keys, > which needs 5bits. This patch allocates an additional bit. > > Reviewed-by: Ingo Molnar > Acked-by: Balbir Singh > Signed-off-by: Ram Pai > [mpe: Fold in #if VM_PKEY_BIT4 as noticed by Dave Hansen] > Signed-off-by: Michael Ellerman > --- > fs/proc/task_mmu.c | 3 +++ > include/linux/mm.h | 3 ++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > index 541392a62608..c2163606e6fb 100644 > --- a/fs/proc/task_mmu.c > +++ b/fs/proc/task_mmu.c > @@ -679,6 +679,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) > [ilog2(VM_PKEY_BIT1)] = "", > [ilog2(VM_PKEY_BIT2)] = "", > [ilog2(VM_PKEY_BIT3)] = "", > +#if VM_PKEY_BIT4 > + [ilog2(VM_PKEY_BIT4)] = "", > +#endif > #endif /* CONFIG_ARCH_HAS_PKEYS */ > }; > size_t i; > diff --git a/include/linux/mm.h b/include/linux/mm.h > index c6a6f2492c1b..abfd758ff83a 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -231,9 +231,10 @@ extern unsigned int kobjsize(const void *objp); > #ifdef CONFIG_ARCH_HAS_PKEYS > # define VM_PKEY_SHIFT VM_HIGH_ARCH_BIT_0 > # define VM_PKEY_BIT0 VM_HIGH_ARCH_0 /* A protection key is a 4-bit value */ > -# define VM_PKEY_BIT1 VM_HIGH_ARCH_1 > +# define VM_PKEY_BIT1 VM_HIGH_ARCH_1 /* on x86 and 5-bit value on ppc64 */ > # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 > # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 > +# define VM_PKEY_BIT4 VM_HIGH_ARCH_4 > #endif /* CONFIG_ARCH_HAS_PKEYS */ this has to be: +#if defined(CONFIG_PPC) +# define VM_PKEY_BIT4 VM_HIGH_ARCH_4 +#else +# define VM_PKEY_BIT4 0 +#endif