From patchwork Fri Jan 19 01:50:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ram Pai X-Patchwork-Id: 863283 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 3zN5DX2kCJz9s81 for ; Fri, 19 Jan 2018 14:00:44 +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="T4aqMCYh"; 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 3zN5DW6K7pzDqqR for ; Fri, 19 Jan 2018 14:00:43 +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="T4aqMCYh"; 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="T4aqMCYh"; 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 3zN3kR1Ry3zF0xf for ; Fri, 19 Jan 2018 12:53:03 +1100 (AEDT) Received: by mail-qt0-x241.google.com with SMTP id e2so468716qti.0 for ; Thu, 18 Jan 2018 17:53:03 -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=SmWIPNL9MTaxuVElIxS6c34H+Mh3PU5KbBtsaVSuT6I=; b=T4aqMCYhjrbqTuUGW+Q0i7bsOCbXT42v/0SALAVAfFqSJBlmaIuIlRV/oiqpZkSG9U AssxlsyaMdRMNT7lRHD1QOv9kM/Io6Hfb3AGFdYnlE2LitY2NnZ0D0DQ6TtOlzJgf2/b YKwBcV46vHF426NnawuwjrDkLhykKt31bQ4VvrHeltOwucuhDC9WLLX335WyLiv7VFco eqsL4xdPeV+ip/P11cIG1F0v2Lsn3FxUdUETPGazlPQ3XxGhGs7A0uwtrWcjRya6hrWC nkvtYuXvYvabDHu+/VTvk96a+nIIckcAFKTBaBvwAI4wPQdYmHoa8kSBuG9QilU0yTbs XlUg== 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=SmWIPNL9MTaxuVElIxS6c34H+Mh3PU5KbBtsaVSuT6I=; b=BGYvcCg6M1LlrsFjqKd7V4cI4P85RlNtdESuhP8Dehfy8mERtaiyWyxhPSKGFiOwwp c77xzaM5UfeEe0hhOky/S8vozTwViIlmMDZ1CyjyAuWoYlLyJypjzkktIDnQ5401CsQv TyRa519LmOHhsrEXCwSE3Zh+/QSghr74c+gZa8CX+21RcEvbxGGESKQD4gNoh3/wuWtS O4KtQlAm7t2hXBSTvVk4ccCkeyPUwVyRUt+x8qLNXgz/p1dvIhQrOzjPRe6Nw/Mx2p+/ DbSqnHoTCQ4bJr+ATcUKkdLE8BU1FJt7vpsh0xewQqFQ5EbqVJltdbD/Y/ziX8KgTL9C w/hw== X-Gm-Message-State: AKwxytelrwEj8YXrBegVKcTQpvWnekU4CwaUY2ciVzFlYZ3mDHxMW8Ni CGqC/Nh2kBsBOY8AO83vycc= X-Google-Smtp-Source: ACJfBovdV1jDVvUfstIhywkJuYjGL1lLERvCvX8uQQViK+vhvkzZqKD/mvhm9flg3JszwEENoVJ92A== X-Received: by 10.55.22.29 with SMTP id g29mr65417541qkh.26.1516326781305; Thu, 18 Jan 2018 17:53:01 -0800 (PST) Received: from localhost.localdomain (50-39-100-161.bvtn.or.frontiernet.net. [50.39.100.161]) by smtp.gmail.com with ESMTPSA id c127sm5483161qke.78.2018.01.18.17.52.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 17:53:00 -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 v10 27/27] mm: display pkey in smaps if arch_pkeys_enabled() is true Date: Thu, 18 Jan 2018 17:50:48 -0800 Message-Id: <1516326648-22775-28-git-send-email-linuxram@us.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1516326648-22775-1-git-send-email-linuxram@us.ibm.com> References: <1516326648-22775-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 8af2e8d..ddf945a 100644 --- a/arch/x86/kernel/setup.c +++ b/arch/x86/kernel/setup.c @@ -1326,11 +1326,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 0edd4da..4b39a94 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -728,10 +729,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; @@ -851,9 +848,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; }