Received: by 10.192.165.148 with SMTP id m20csp551994imm; Fri, 4 May 2018 15:01:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqFwf47WkX40ewQFeulhSfzgSEyEQveFlMKJGGESHcVT04Fp+tzLq91urAIgNZ5w6Cjlvoq X-Received: by 10.98.144.86 with SMTP id a83mr18076751pfe.186.1525471293340; Fri, 04 May 2018 15:01:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525471293; cv=none; d=google.com; s=arc-20160816; b=gG0J568CQdg8oN1qPLLKk3GH3+SBHJXpcD7NJUljtbeh+j4u47LgDBxH3Sl4QraVi6 g5Ubqak+UkCIvE3ve7xm2L3j6OF8JXFV9zXR3zZtR+jmffH8aAesDjdmQyELmRzvqqp8 0p6B5jbV4SsjqzTcJuoj+wOvdh2Oj03halGoYeb/csrb+WGP6PdmCKhA8iT8q4rCHBHR Sxv3sxjaznAF+V0+RyFhSsQ76GgpbEQrd1fLxr6KCg1Ojh10EMG29vk/zMbu4kpJtUMX 1hClLW1chSpnaYNsdA3bLAqeDkZrwVc3zVjuhMK2YpQIExMlMuFZVukf7cQ9GaajcXgM 1naQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=Hi5vBuSEYbrCryJmiwvybG0RbNSF7n8JqQqwf0VQGII=; b=whpBXYVCQkJGoUW5LjmKaAjK2eympU/Tf7VF0kV0TFALLcv7NFlCRjXzvhojl6zpcA Gr6MfpzLV9piy78Zepn0xtuQVSdhmRai13w+3b49BTDDohknz0fgEER8n2mrJYgfLJxB IySwgZ0WdtdBi6y2LeT6FgPNWdpi4gsdoUJa8NhDX5aHk9MYy8H326GUjOeRd4UvlQH9 5dUpL2SIybI9zJHSv6jViaQJ7y7TxjSkdJH0nYwggbDrfl/buaVciJKtWyGfAgKtN71l iRGvYsbE1sw5hxVTj0jO6bI8Q4Wb/MgHh3ISR80agiJ56nXu9d8L67a020Hv3GPkBSWd 03uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=s6ZhN8Rj; 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 i33-v6si8414634pld.546.2018.05.04.15.01.19; Fri, 04 May 2018 15:01:33 -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=fail header.i=@gmail.com header.s=20161025 header.b=s6ZhN8Rj; 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 S1751835AbeEDWAK (ORCPT + 99 others); Fri, 4 May 2018 18:00:10 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:46189 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeEDWAH (ORCPT ); Fri, 4 May 2018 18:00:07 -0400 Received: by mail-qk0-f195.google.com with SMTP id s70so17800709qks.13; Fri, 04 May 2018 15:00:07 -0700 (PDT) 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-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Hi5vBuSEYbrCryJmiwvybG0RbNSF7n8JqQqwf0VQGII=; b=brnQLEQNOvwRoHMCm1cuXsDmf5cYwg6vwhqt3i414YFLz11xO3eghUQQh9Xgp8bF1k dmVTkAtAau69eerAoEbVKdpy54n4m46PdEEGfy3vxL+2pDBGELldT4zInhCmpl+2tLAO eKV/B1y+xx4sHskzXDHIMi1GX51Q4/5pUNfKRgcYCOwgYda7I6pjp9BXGqP2NEpHJ4lg Hrh+WDwYgBVxqDsueEVNHEza0zDQnJl5pK9/pglnoQAtLa6dhEljnoyCgmO7W+7tXT/L FZnQQfAxQJXw/49tTQCAdwPsqoY4gHzEs6c1FoeM2Nf5oc+RGe8UmeFRb9ssAC6Fhffq YFVQ== X-Gm-Message-State: ALQs6tArrDuhQNJ/efDNYXCsmV+SIGjorrkvwICbenrQzFpaHf2PRdpo AQ/esvPCA2ZFBAEFgeyaRtw= 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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) -- 1.7.1