From patchwork Tue May 8 14:59:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Ellerman X-Patchwork-Id: 10386283 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EA865602D8 for ; Tue, 8 May 2018 15:00:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA12228E16 for ; Tue, 8 May 2018 15:00:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BEF9428DFB; Tue, 8 May 2018 15:00:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63D4028E02 for ; Tue, 8 May 2018 15:00:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DDEF76B0291; Tue, 8 May 2018 11:00:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D8C326B0292; Tue, 8 May 2018 11:00:00 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BDE626B0293; Tue, 8 May 2018 11:00:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f72.google.com (mail-pg0-f72.google.com [74.125.83.72]) by kanga.kvack.org (Postfix) with ESMTP id 7B60A6B0291 for ; Tue, 8 May 2018 11:00:00 -0400 (EDT) Received: by mail-pg0-f72.google.com with SMTP id s8-v6so18636708pgf.0 for ; Tue, 08 May 2018 08:00:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=CZlfdK5jQGglxs/2m36egB86Lsqvvk7EF7l62XaQyfo=; b=E4H7Gp4+MgiMeZi8oKBoR/vj2t6IWSOpWSixpMNyIuq2IK8VPvwvACJ+Ml6RI98ze/ li5CpR51UE1hUXr3Vok0tIuyPzi0gD3ibW6akLte5AdtWsgyoMfIqhBDLkzGFBYQ+msd SFPvx8smvoRYk63c8gmyDLfVGFJwxLt9MYy9PD7R1oprOeEJ2byKNvIWhR4m670vvwzh lvcEZ6MDljSTAKlw9IVEsvS6zvJFhyHg7eEUaS3XtWr/tOHlcKvnPgr8IaoZlyOH3ivK lHoGFxT2k2gjtdggnVivb6S84eviL5V79iB3nfo3UsiW8qftFEVD68kIbdzcMy0LRCnI dT8Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org X-Gm-Message-State: ALQs6tDDL98UAowrNuo8BpBSwrmjMvrLhSiPZrkH7d1OYuG434RWYaQf c0JLxxUTepLuff4s8kKaR1hftBJSvsuvEFA3J1tsbNIFTzBicaRKIb5iwWyG9w7Qryn4bSbFvyY 44tFMEi2xGbeL1Es4gpqHL+fNOPVZOeiMs10p3gC0qrkss31EF+bqBsRVwFlDI24= X-Received: by 2002:a63:a807:: with SMTP id o7-v6mr10542091pgf.153.1525791600181; Tue, 08 May 2018 08:00:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXlcfx5nUf1hyfEsJsPSXIiRG6N4zYOAiO3UwYvRTR82WQg95uHqQqE6YSITWfItS8oBow X-Received: by 2002:a63:a807:: with SMTP id o7-v6mr10542056pgf.153.1525791599362; Tue, 08 May 2018 07:59:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525791599; cv=none; d=google.com; s=arc-20160816; b=q6VNpzSHp8nIwcfJ9XLF1+oLRjHEU3GL95gFNYzL7EFJjUWAUts2rt+ppYyOH/fbaq FMLnMLFK8y28AvPhppTMSnmHWAHAmgRwe6SzlfqpmRO+7YlZo1VZK9vWh3MlVFDO6qPq eU6/c7B2UKQAbEAxkRPCr8byNMaEYhkLz+a2Se7q42/rWsc1wVoptfXVgLGAxDaCh7r3 72sXmcyM0GkHlLCq8JJ25bVguq45Y/5jCsWxBSZY3A4nLRqRfCGQKaJ15IGTQ4fxfjCj 5Vze8Fn+M9sT+XLZ2VeC7oYQPpZ+cPXVh0vlofmmW/bTBIxD1wUaRgE7EzK7YKB0bHw7 1VEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=CZlfdK5jQGglxs/2m36egB86Lsqvvk7EF7l62XaQyfo=; b=ane7fXnDnfp3PRlE94KocYdjB22WNdxThHcr1sWOax0aXlt12K3cK4W65teVZc4f1N SA2QAb8MniKpCv7T3tPXxF+qpTx/MH65uwXpvm89F/ekh3iCOKLmWEYcwBddYCvCI6gm ae+qzWt+nagC5w8IlrFrvvPocv37THpHFuGRly3jhXrS7B0wIRg32sv9Ivngd9NRhgcm zrd0i8st/BerizXJOOm7RowwH0JC32fsPPzY98Xc+mRREcsEp8dGASPaxakxRdSXCVvu /V7BaHHcJGAQGCppBcx18XyQ6IN2NTKqUk/f4lmWgIW24Q4hsFy3HY+7I61wAVjNrSIO NVnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org Received: from ozlabs.org (ozlabs.org. [2401:3900:2:1::2]) by mx.google.com with ESMTPS id r63si24388314pfj.331.2018.05.08.07.59.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 08 May 2018 07:59:59 -0700 (PDT) Received-SPF: pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) client-ip=2401:3900:2:1::2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of michael@ozlabs.org designates 2401:3900:2:1::2 as permitted sender) smtp.mailfrom=michael@ozlabs.org Received: by ozlabs.org (Postfix, from userid 1034) id 40gN251kYvz9s34; Wed, 9 May 2018 00:59:57 +1000 (AEST) From: Michael Ellerman To: linuxram@us.ibm.com 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: [PATCH 2/8] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey Date: Wed, 9 May 2018 00:59:42 +1000 Message-Id: <20180508145948.9492-3-mpe@ellerman.id.au> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180508145948.9492-1-mpe@ellerman.id.au> References: <20180508145948.9492-1-mpe@ellerman.id.au> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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 */ #if defined(CONFIG_X86)