From patchwork Mon Nov 6 08:57:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 834595 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yVpfc6t5Vz9s7c for ; Mon, 6 Nov 2017 21:27:52 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Proags8z"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yVpfc5QZzzDr1w for ; Mon, 6 Nov 2017 21:27:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Proags8z"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400d:c0d::241; helo=mail-qt0-x241.google.com; envelope-from=ram.n.pai@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Proags8z"; dkim-atps=neutral Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yVmhq5wR4zDr5J for ; Mon, 6 Nov 2017 19:59:39 +1100 (AEDT) Received: by mail-qt0-x241.google.com with SMTP id j58so10030244qtj.0 for ; Mon, 06 Nov 2017 00:59:39 -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=FTxvcIpNFAgqYwpUqbxzcUk7bGfiGbCCzcydb7aEQcTxIYfm57e8FGk+/nkEw0qdE0 INj7Kwy9z5GFUHg6wp8Kk2o6fvKBDOS73cL+Sy0zHFNKW2mB89Wk+p7DGYUrvvb1bbIb le6TxEPtkIyGL8EiuqqD4c0sOCiUZf7A2sZTilKG27U6aQl3RitxGZgHwyBLzbapDbft fmUDJMboN2GOsYKmECUXyY8zhoSkmEg4vb1Db0SgLjxtmJztLqC5M0UyA+pHbrd3MIHE VTldBD6rtfzsNpPb19Z1kIhNgFRYwjBqN8VMOFlb9ZOuR8MW/2SUjhr1c0zZAb+Ha/Jl isPw== X-Gm-Message-State: AMCzsaVyy+ezOLNbjGDnukX4KaBRCcPXka+at81PSi/PgKTZJ/atmdOB qRaXOwl84KD78zRy4yUdy78= X-Google-Smtp-Source: ABhQp+R4w9IgR44NcT1ROU9tbihC9C+D9D7Aj83LiUc74Qdm/rX5iJQ+bGfPMe9J7y5vSjL8KrknQw== 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 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> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, ebiederm@xmission.com, linux-doc@vger.kernel.org, x86@kernel.org, dave.hansen@intel.com, linux-kernel@vger.kernel.org, linuxram@us.ibm.com, mhocko@kernel.org, linux-mm@kvack.org, paulus@samba.org, aneesh.kumar@linux.vnet.ibm.com, linux-kselftest@vger.kernel.org, bauerman@linux.vnet.ibm.com, linuxppc-dev@lists.ozlabs.org, khandual@linux.vnet.ibm.com Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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; }