Received: by 10.223.176.46 with SMTP id f43csp1197382wra; Fri, 19 Jan 2018 08:11:31 -0800 (PST) X-Google-Smtp-Source: ACJfBovQLdOSqLGRshE/LG0v4/OGDfb4SjosbNKyZrRfcsQX5TqM0cBYhgiCiXUaE+vo9qUoMURG X-Received: by 10.101.86.201 with SMTP id w9mr8326227pgs.434.1516378291602; Fri, 19 Jan 2018 08:11:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516378291; cv=none; d=google.com; s=arc-20160816; b=BC8NzunY0BHjQInwrchPWjuvfsV7L7/UhpDu/RRf99wkQG/KL026USEKiUPyHJ8Q2I Q8kiMhOaH0tECg71Ipi8eNLwWJb6y9cxT5tEfPSXhu/qyoFcxyGZQSpXz1d3L+O4Xvyy AUMIxkCyBCs72OSVCHPpk79YiuZSDhdzWr1wpJRo6AhxXjnv8Cw4AedB7F8NgSFsMsdT 3w/xNBzjB9D3ObjiRuLhdQE6RgI3H9sehNCBY9XM+Yce9cWs2Ib9ql30UQd/4XZkxhZC fODmyzvPiCFN8G5DZx+p0AZsSZDBVXojP3dVRHNj0LacYOyA5X8IjKqyELSGW29Lfly0 tgbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:mime-version:user-agent :message-id:in-reply-to:date:references:cc:to:from :arc-authentication-results; bh=QBLbrlWCmNJGo9zkRqDSeJwDAnA9RvnDL2qsOUBWtnQ=; b=B2GWtqrEcUfbiGGNJI3XtinqXje2OvC1hWrAGmkkiMAihZM1rP4mUXFYWRzkkrER99 04aPQbpa6yYOOqhTaW6tdkaA8L439v9ngtxBD7D6JNbPNm9mRnTdiT9VfrxCBJO4htIJ 8VgoojxyLCQRhr8vpYae6k1Bq+M9aG4Fq4Pr2OGuEgMCxSPYiUDETvJ8uDo7+PPORxZg vLlslxb1kAWPz6Gpl8PmxxLM4mmR/9xupPS8FbTZ227BZoDp5ab0VCgQVVKRCyO1arCr 00ySgPlyJTGhBPnrl3FZWrr2XHCQkZQCoYWn6Z5IHzMVKb2jsuLwmxClYOZFSyxfPNhh I/5w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 69-v6si924144plc.814.2018.01.19.08.11.17; Fri, 19 Jan 2018 08:11:31 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755985AbeASQKq (ORCPT + 99 others); Fri, 19 Jan 2018 11:10:46 -0500 Received: from out01.mta.xmission.com ([166.70.13.231]:33675 "EHLO out01.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755581AbeASQKj (ORCPT ); Fri, 19 Jan 2018 11:10:39 -0500 Received: from in02.mta.xmission.com ([166.70.13.52]) by out01.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ecZFU-0002mh-SV; Fri, 19 Jan 2018 09:10:36 -0700 Received: from 97-121-73-102.omah.qwest.net ([97.121.73.102] helo=x220.xmission.com) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1ecZFT-0003nX-RA; Fri, 19 Jan 2018 09:10:36 -0700 From: ebiederm@xmission.com (Eric W. Biederman) To: Ram Pai Cc: mpe@ellerman.id.au, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, arnd@arndb.de, 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 References: <1516326648-22775-1-git-send-email-linuxram@us.ibm.com> <1516326648-22775-28-git-send-email-linuxram@us.ibm.com> Date: Fri, 19 Jan 2018 10:09:41 -0600 In-Reply-To: <1516326648-22775-28-git-send-email-linuxram@us.ibm.com> (Ram Pai's message of "Thu, 18 Jan 2018 17:50:48 -0800") Message-ID: <87shb1de4a.fsf@xmission.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-XM-SPF: eid=1ecZFT-0003nX-RA;;;mid=<87shb1de4a.fsf@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.121.73.102;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+D1OChiC7w+tcX04eysXIQF4bk0fiVL64= X-SA-Exim-Connect-IP: 97.121.73.102 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa04.xmission.com X-Spam-Level: * X-Spam-Status: No, score=1.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TVD_RCVD_IP,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, T_TooManySym_02,T_TooManySym_03,XMBody_17,XMSubLong autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.0 XMBody_17 BODY: Spammy words in all caps * 0.0 TVD_RCVD_IP Message was received from an IP address * 0.7 XMSubLong Long Subject * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.4999] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa04 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_02 5+ unique symbols in subject * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject X-Spam-DCC: XMission; sa04 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Ram Pai X-Spam-Relay-Country: X-Spam-Timing: total 700 ms - load_scoreonly_sql: 0.03 (0.0%), signal_user_changed: 2.3 (0.3%), b_tie_ro: 1.56 (0.2%), parse: 0.79 (0.1%), extract_message_metadata: 3.0 (0.4%), get_uri_detail_list: 1.44 (0.2%), tests_pri_-1000: 3.7 (0.5%), tests_pri_-950: 1.09 (0.2%), tests_pri_-900: 0.93 (0.1%), tests_pri_-400: 31 (4.4%), check_bayes: 30 (4.2%), b_tokenize: 8 (1.1%), b_tok_get_all: 10 (1.5%), b_comp_prob: 2.2 (0.3%), b_tok_touch_all: 6 (0.9%), b_finish: 1.88 (0.3%), tests_pri_0: 646 (92.3%), check_dkim_signature: 0.49 (0.1%), check_dkim_adsp: 2.7 (0.4%), tests_pri_500: 4.2 (0.6%), rewrite_mail: 0.00 (0.0%) Subject: Re: [PATCH v10 27/27] mm: display pkey in smaps if arch_pkeys_enabled() is true X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ram Pai writes: > 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 Would it be worth it making vma_pkey a noop on architectures that don't support protection keys so that we don't need the #ifdef here? Eric > show_smap_vma_flags(m, vma); > } > + > m_cache_vma(m, vma); > return ret; > }