Received: by 10.223.164.200 with SMTP id h8csp921326wrb; Mon, 6 Nov 2017 01:00:35 -0800 (PST) X-Google-Smtp-Source: ABhQp+Rl5Mf37rY9rv3oz4665xUxepnDno5Xo+e96BQjCtB46U5Q+utHnVnnNxvL+0d62+z/ydvg X-Received: by 10.98.163.84 with SMTP id s81mr15837847pfe.64.1509958834936; Mon, 06 Nov 2017 01:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509958834; cv=none; d=google.com; s=arc-20160816; b=hHmamU324cYyjh23TYm/K4fWA7SRNQ04hwtma0y1Rd8z4g+75bbfxgIJ3GLt/7fX+l /WHlwMLNnQo3ASB8cz/T3XwPdqYW2Czjy+1Qc3c6tDoYSMGi/XKoFjbQH/Nqr4MiC4IT azJonqGJ5EoMvDw9BiU7VwOH4x3NbFwiv7b468FqeKNJdeJOeDmqjqLo6AAv11g8iriX eSM3SQ04Z3o9iJ8zfwAZShG7ySIacGnNjh4fDOUOE2mzna8MEtNTA/UkQuHU4VjWGt+k Mhi1dig9EoyazWDBLzSeGfBWUB7T0pqoPVfRG/OO54qT0RjfV/oChI0R/zRu+1BE1wGL WuOQ== 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=Jm/q+uEN/04eT1ckavpTGYcffBeNQFsi4QQU9Kcnmik=; b=SE7eNLZUHCGS/XHsppyGDKu0rXT0f0kAX9/QYxKD2srnvG6gJvU7wQPReSZFg4huAj hnC/aXHidya+wLZ4i2EyvynAm9biFxa47BLJruh3seyRG3jcjtBDZUV8b4Bgu/NriQiH 9fY/quc3TKxZ+x71dkKjpedrPBXNK3zuz4a/q3fi/IHCltMhX7oLjWV4Mx7KPX2bEd2R gq1KMaewRyLa8vLN67NeoFpTnccAB1D37c8fJw8rhsvoRv0Ug+hu9+rAUY7EZ1Y5cHYv m80s7EXVpERmFV9DIhvi33U+vg94/qKm4z3143L2rA780MOsXlWqrSNRZqlxApeNwniy /lyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Proags8z; 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 x6si10933489pgt.77.2017.11.06.01.00.21; Mon, 06 Nov 2017 01:00:34 -0800 (PST) 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=Proags8z; 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 S1752474AbdKFI7m (ORCPT + 98 others); Mon, 6 Nov 2017 03:59:42 -0500 Received: from mail-qt0-f194.google.com ([209.85.216.194]:45757 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752445AbdKFI7i (ORCPT ); Mon, 6 Nov 2017 03:59:38 -0500 Received: by mail-qt0-f194.google.com with SMTP id p1so10029461qtg.2; Mon, 06 Nov 2017 00:59:38 -0800 (PST) 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=Jm/q+uEN/04eT1ckavpTGYcffBeNQFsi4QQU9Kcnmik=; b=Proags8zBsat+s+zJge+iMtDjji8PYzdX1hGCyAPHfspbpRQaN2Dw0uak7FzDdjT6q lnGx920avolqS0L2sSYJoXvb7ZjN3wL51KTjTmL1SIO68EICV1WgJdRLkkdIZbO2BGvz 5eCV+UjKMF0ViZYgWwH0MHrpEEIS51p4V5rxsuSqsYDK+58WuvLOZGyZIaGftevXHsQo Cjethm+/iTlqeToMeDxzAYeSkE+YAtd3zV6p/mC+FKxV0XuWzLrdIx3znEHKSVcZr24Z tSoxcR4TYFfcCb6GUXPeK09s9r4Uz5xel+7vK5MTz6Hte2q2ONg6JyEgLmWM8XmoTSdx NUtA== 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=Jm/q+uEN/04eT1ckavpTGYcffBeNQFsi4QQU9Kcnmik=; b=E7XSfSSlETJs0TvdUsBkMO58CGI7P+xVOVedlCbolrh+CFKf5xT78gsASdIdYEIV/p r7k3Ifgw0RbmvxHhKw2IadVxUjaKFOyE7/HxGkZra66PB39GGvttYdBGVB/BsFoNnTix BAkDrdoF6y7aHZ3R4VdfWO1xR9UqZB9/2xy0JPReCrG4pXO+LUL0iqgvwX+mkpzvu8S8 y39F2Kpv0A8wy6mhAx/lS8aA+kcCD94g+V7rU1Kqw5HkWB8DORznEmGAyctzOnrLk0+k YiCPqmIGzKCqa/0jwDzmx1YP7sAP5M5yEMHy8nd/pj2EbLoFcYHo8M7ZOaWYfE9EOnIA hISA== X-Gm-Message-State: AMCzsaUrMWiy2LqBAbGieJr5nQMJh/v05tZBOMkmO9NFGVIKD7Z9Yrad mbwF8mwpaKTxVOFAJpyuNVs= X-Received: by 10.237.60.154 with SMTP id d26mr20167117qtf.227.1509958777802; Mon, 06 Nov 2017 00:59:37 -0800 (PST) Received: from localhost.localdomain (50-39-103-96.bvtn.or.frontiernet.net. [50.39.103.96]) by smtp.gmail.com with ESMTPSA id r26sm8001094qki.42.2017.11.06.00.59.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Nov 2017 00:59:37 -0800 (PST) From: Ram Pai To: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de Cc: linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, x86@kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@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 Subject: [PATCH v9 28/51] mm: display pkey in smaps if arch_pkeys_enabled() is true Date: Mon, 6 Nov 2017 00:57:20 -0800 Message-Id: <1509958663-18737-29-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1509958663-18737-1-git-send-email-linuxram@us.ibm.com> References: <1509958663-18737-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 Currently the architecture specific code is expected to display the protection keys in smap for a given vma. This can lead to redundant code and possibly to divergent formats in which the key gets displayed. This patch changes the implementation. It displays the pkey only if the architecture support pkeys. x86 arch_show_smap() function is not needed anymore. Delete it. Signed-off-by: Ram Pai --- arch/x86/kernel/setup.c | 8 -------- fs/proc/task_mmu.c | 11 ++++++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c index 0957dd7..b8b8d0e 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1357,11 +1357,3 @@ static int __init register_kernel_offset_dumper(void) return 0; } __initcall(register_kernel_offset_dumper); - -void arch_show_smap(struct seq_file *m, struct vm_area_struct *vma) -{ - if (!boot_cpu_has(X86_FEATURE_OSPKE)) - return; - - seq_printf(m, "ProtectionKey: %8u\n", vma_pkey(vma)); -} diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index fad19a0..5ce3ec0 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -731,10 +732,6 @@ static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask, } #endif /* HUGETLB_PAGE */ -void __weak arch_show_smap(struct seq_file *m, struct vm_area_struct *vma) -{ -} - static int show_smap(struct seq_file *m, void *v, int is_pid) { struct proc_maps_private *priv = m->private; @@ -854,9 +851,13 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) (unsigned long)(mss->pss >> (10 + PSS_SHIFT))); if (!rollup_mode) { - arch_show_smap(m, vma); +#ifdef CONFIG_ARCH_HAS_PKEYS + if (arch_pkeys_enabled()) + seq_printf(m, "ProtectionKey: %8u\n", vma_pkey(vma)); +#endif show_smap_vma_flags(m, vma); } + m_cache_vma(m, vma); return ret; } -- 1.7.1 From 1583245100946443742@xxx Sun Nov 05 16:43:09 +0000 2017 X-GM-THRID: 1582782361389199767 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread