From patchwork Fri May 4 21:59:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 10381733 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 29C3860159 for ; Fri, 4 May 2018 22:00:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17E942959D for ; Fri, 4 May 2018 22:00:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C0BF295A7; Fri, 4 May 2018 22:00:11 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham 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 E21052959D for ; Fri, 4 May 2018 22:00:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A57F6B0010; Fri, 4 May 2018 18:00:08 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 42BC56B0269; Fri, 4 May 2018 18:00:08 -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 2CD326B026A; Fri, 4 May 2018 18:00:08 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f199.google.com (mail-qt0-f199.google.com [209.85.216.199]) by kanga.kvack.org (Postfix) with ESMTP id 058756B0010 for ; Fri, 4 May 2018 18:00:08 -0400 (EDT) Received: by mail-qt0-f199.google.com with SMTP id n33-v6so4412784qte.23 for ; Fri, 04 May 2018 15:00:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:from:to:cc:subject:date :message-id:in-reply-to:references; bh=Hi5vBuSEYbrCryJmiwvybG0RbNSF7n8JqQqwf0VQGII=; b=azhlMp/jYVYbP1Z0P9KRJmxJxZ43lpCcv98GtuQwnRYiC2LZsnDk/zS9jsfBH8cxcO RPUbvS7rRK3Ez2+rsCdVtTxxDkMNek6zkhNTL+J/p33x70uTjFKxn4qH4OuUMtfs5dK/ QnbUrjq4wvW8GYCsAMZH7h5cmTAH/HjTLsllUHDu8vhrlYbrzxDj5gMlPSQzrwbJSrMN rXXPucWybN3IQEEj4/oYgUO2soGZP86oRPLE0qPYGPQCVGyQk47I/qsnw994B9GfGowq tt2Zm7vtJKbU9kqVU8Kz5I6hdKgv5WHpOGQnI+mFWbUj2QFtHyzrIULQ4AbOHPlTUkuo Ekeg== X-Gm-Message-State: ALQs6tABvvJjdBN84RfSq9G6XIvdiT4gjkOgSzcftJZQ+LRWSN12ioUe gTvPXiEKOntby4J2XSOVCM8KZp98MubYgReIaf6BbvzwVuWX1xX8MW9ybZgm0yku5hr3r7kZ1wT pLjD925UdwFldk/RsQtPRXmQgbniEIRSw/lWpvNB4l07zs1LoUyY3v7EI2dIk68ORdlg/wJpBu4 0pr45Juqomavo3rXEso0A0bGN4FXTf2DsfvzVpUylcmfWGGdP7ClZA17I+TRXGZDyawJMhEEfcv LEyBvySkFqMjZxz9wbyQvndjkBwaEcpXo5YVm2PfrcPzI4Xgo52+iib6TwTZkBXf84nKZPx3s5Z KIW5E72lr0Zbv6ANXtw81k7wwJvgZdv8snJJeVuz95tvh/6Mrr6JEsa8FiVDlaaGOQJcmqciwg= = X-Received: by 2002:ac8:2f3b:: with SMTP id j56-v6mr25230349qta.224.1525471207755; Fri, 04 May 2018 15:00:07 -0700 (PDT) X-Received: by 2002:ac8:2f3b:: with SMTP id j56-v6mr25230324qta.224.1525471207215; Fri, 04 May 2018 15:00:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525471207; cv=none; d=google.com; s=arc-20160816; b=txY+ey3CqtdvO7g2gNdpLEPV6ZB+CwN/beKrE9prkz26bRUpZL8mey244tZwND91+d FN1ltpG1gL9JxlJt4xEKVFVhQkRRdx0ZOQdxOdZ40c1vYzRMaM7yrAR0ER+dVitEChvs c3bjV193d/3hJC2+2ALpzRKVnAm5bDfntc67FaA+oW//nygJeD9rkLeTwIpL/YCjKWsW 4ifveMjRirlwxb32mFdCFMKO+68XkImLYHasZ/oxQHL7YdGmTdoKN/Qh7/0my71jnuLR FjLGmyGLADkbMFYVwBFu+WT9LA88tVLZ7uFpYH45ecf4fFDL8wQ4hqNA4AIzuizS4CTI ZP2w== 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:sender :dkim-signature:arc-authentication-results; bh=Hi5vBuSEYbrCryJmiwvybG0RbNSF7n8JqQqwf0VQGII=; b=d4XqJs0qyeSDiTaxyC/M3QkTvkwmSjE/SC1OupCPVMF0+Goavr1WurG6pppWuppfBG +Df1wbK4305ZibxS/wAbHp/Wz9fQQaF7WF1YvHbh44yDCNASHzdgFwA5POjrdSDctHL0 TwNKfsEt2fOmFVzU/2UM5y7X1wN5l2TPnS9u5qMjf9p++FfxWONGkE+tmkMxghW1mBoQ Qg4JSfxLI9OcHGdYWxZmoD0gRoxCdNMoyuLuuW3aaSYvFKDBs1+nbFMDAU8rMgZGdsO3 hCoKu1RT6X+D28bypj7RW0lmr2CV3NoUYKz3VnYPfwti5sy1vo1NmlMS7AvMCQP4UHAo hkPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s6ZhN8Rj; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id m187sor2201991qkd.99.2018.05.04.15.00.07 for (Google Transport Security); Fri, 04 May 2018 15:00:07 -0700 (PDT) Received-SPF: pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=s6ZhN8Rj; spf=pass (google.com: domain of ram.n.pai@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=ram.n.pai@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Hi5vBuSEYbrCryJmiwvybG0RbNSF7n8JqQqwf0VQGII=; b=s6ZhN8RjAY7DPsAwlV0p1NVQIJcIlh2DVQqMa8IQgsIDzZEOqnntLAVeagAxZo5eCR 6pGgbblPMwp1UchvlDy3x1rS7VQNkmiLoCn9X8l8Vu7eDzZs8n5ci274Oh53sUnMmMkN OiMujlO1sAgQfqlrpVlncpUgfyaUeQOSaadWaAr0Hlgr3owvX/R9r2EMw44f2WLal603 Vv5hYlKNV9orJ+fbI0CNbdTEvDClLv+NloGZFNj8G1lTEKKdZvLhnfXT/J179hcoVjmY pN5g6YoSZs7lHLnF0oFUKsXSJCwbhc6gc519d/asjluG86s3G/6cf+aX/nbsltd1ZV9y MczA== X-Google-Smtp-Source: AB8JxZrFnkGHBunJCYs/d/ZOQ3Qw++NawA3Gj9rYk5fpT13UI6mbTzqHtqH0yBBZzvm/x+XcsPrTpQ== X-Received: by 10.233.223.6 with SMTP id t6mr13446659qkf.46.1525471206958; Fri, 04 May 2018 15:00:06 -0700 (PDT) Received: from localhost.localdomain ([170.225.9.142]) by smtp.gmail.com with ESMTPSA id i45-v6sm15488910qta.12.2018.05.04.15.00.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 May 2018 15:00:06 -0700 (PDT) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, dave.hansen@intel.com, benh@kernel.crashing.org, paulus@samba.org, khandual@linux.vnet.ibm.com, aneesh.kumar@linux.vnet.ibm.com, bsingharora@gmail.com, hbabu@us.ibm.com, mhocko@kernel.org, bauerman@linux.vnet.ibm.com, ebiederm@xmission.com, linuxram@us.ibm.com, corbet@lwn.net, arnd@arndb.de Subject: [PATCH v13 1/3] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled Date: Fri, 4 May 2018 14:59:41 -0700 Message-Id: <1525471183-21277-2-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1525471183-21277-1-git-send-email-linuxram@us.ibm.com> References: <1525471183-21277-1-git-send-email-linuxram@us.ibm.com> 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 VM_PKEY_BITx are defined only if CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is enabled. Powerpc also needs these bits. Hence lets define the VM_PKEY_BITx bits for any architecture that enables CONFIG_ARCH_HAS_PKEYS. cc: Michael Ellermen cc: Benjamin Herrenschmidt cc: Andrew Morton Reviewed-by: Dave Hansen Signed-off-by: Ram Pai Reviewed-by: Ingo Molnar Reviewed-by: Aneesh Kumar K.V --- arch/powerpc/include/asm/pkeys.h | 2 ++ fs/proc/task_mmu.c | 4 ++-- include/linux/mm.h | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/asm/pkeys.h b/arch/powerpc/include/asm/pkeys.h index 3a9b82b..425b181 100644 --- a/arch/powerpc/include/asm/pkeys.h +++ b/arch/powerpc/include/asm/pkeys.h @@ -26,6 +26,8 @@ # define VM_PKEY_BIT2 VM_HIGH_ARCH_2 # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 # define VM_PKEY_BIT4 VM_HIGH_ARCH_4 +#elif !defined(VM_PKEY_BIT4) +# define VM_PKEY_BIT4 VM_HIGH_ARCH_4 #endif #define ARCH_VM_PKEY_FLAGS (VM_PKEY_BIT0 | VM_PKEY_BIT1 | VM_PKEY_BIT2 | \ diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 65ae546..0c9e392 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -673,13 +673,13 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) [ilog2(VM_MERGEABLE)] = "mg", [ilog2(VM_UFFD_MISSING)]= "um", [ilog2(VM_UFFD_WP)] = "uw", -#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS +#ifdef CONFIG_ARCH_HAS_PKEYS /* These come out via ProtectionKey: */ [ilog2(VM_PKEY_BIT0)] = "", [ilog2(VM_PKEY_BIT1)] = "", [ilog2(VM_PKEY_BIT2)] = "", [ilog2(VM_PKEY_BIT3)] = "", -#endif +#endif /* CONFIG_ARCH_HAS_PKEYS */ }; size_t i; diff --git a/include/linux/mm.h b/include/linux/mm.h index 1ac1f06..c6a6f24 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -228,15 +228,16 @@ extern int overcommit_kbytes_handler(struct ctl_table *, int, void __user *, #define VM_HIGH_ARCH_4 BIT(VM_HIGH_ARCH_BIT_4) #endif /* CONFIG_ARCH_USES_HIGH_VMA_FLAGS */ -#if defined(CONFIG_X86) -# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ -#if defined (CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS) +#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_BIT2 VM_HIGH_ARCH_2 # define VM_PKEY_BIT3 VM_HIGH_ARCH_3 -#endif +#endif /* CONFIG_ARCH_HAS_PKEYS */ + +#if defined(CONFIG_X86) +# define VM_PAT VM_ARCH_1 /* PAT reserves whole VMA at once (x86) */ #elif defined(CONFIG_PPC) # define VM_SAO VM_ARCH_1 /* Strong Access Ordering (powerpc) */ #elif defined(CONFIG_PARISC)