Received: by 10.223.176.46 with SMTP id f43csp1267227wra; Fri, 19 Jan 2018 09:05:59 -0800 (PST) X-Google-Smtp-Source: ACJfBouUKRQBdvF+VOohlUHvmLDPkaOP/XGQXAT2crPQ/0XEfHz5F4lt4aq499Nve2KYEaN/WZJg X-Received: by 2002:a17:902:4283:: with SMTP id h3-v6mr1957678pld.175.1516381559155; Fri, 19 Jan 2018 09:05:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516381559; cv=none; d=google.com; s=arc-20160816; b=qQMLQ3VX5R/RUr7R0Hm8RNYFZ9igQXKKYRNiHvCcCYyuDGrbxDIAmRBcv69/4vXulh rDuvJnq8IeMXnpe4huETM27Cpcw62PXI41Q/JoWuYHk53DWd2fFyCk/u2FKeMy67bGw0 ffkQ0q97m/ujsN8Ttam5mMNb3gxRCOhKfiRYzsyKPBVw+OI9JrzVJTvVguxElydCNHw9 YQ38R8IQS+pMVeuss4iy3QabnYo6TDgia/81m2wNBjEcR1rq7XKxwE7q+R3hqv4PFvAj EYQzmLcc7aJ13UNDB8XzJdd4jNGU0EGdz7Lrj3dV1dsCzdSb+UCB88YIE0N2VKY0vPmh if4Q== 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=2ZFTPO0FugOnVf1UJZOayNd1VwD1SyCXWZKTlSF+qWc=; b=LhPuIXcTuANEKB4wwAZhha+8fHhYzTIHrbauUM7ZFjfkrUANBInIPjFTf85DxkFTgm pXvV8ZG3fix1FS6J+rgHHI2hQVjnzmXNUOXQ/8+9Ott9tEXN4rg22e+qM6FRZOqboxa7 Q+mU1J1wMjfdLkWnM7UR1ueMpXbtcbxPTkh6MV5bvBSXAvgTBlnw+EAtD1bi0JlDeJ86 VWYTqMPHpQ2bKfa91TWY78rodpwcgbNSkbL9gYDviUbnvrL+jhjWEac5zSRdiALw0tIS tI8R6cQj2DJLTdWW99hHQ0+xhFLB7bmzqen0pGsMi/iTz5KIyrWVwH+zgtQ7amb2OXHI 2zUw== 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 62-v6si800087ply.651.2018.01.19.09.05.44; Fri, 19 Jan 2018 09:05:59 -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 S1756107AbeASRFL (ORCPT + 99 others); Fri, 19 Jan 2018 12:05:11 -0500 Received: from out02.mta.xmission.com ([166.70.13.232]:33924 "EHLO out02.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755878AbeASRFD (ORCPT ); Fri, 19 Jan 2018 12:05:03 -0500 Received: from in01.mta.xmission.com ([166.70.13.51]) by out02.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eca68-0004I0-EZ; Fri, 19 Jan 2018 10:05:00 -0700 Received: from 97-121-73-102.omah.qwest.net ([97.121.73.102] helo=x220.xmission.com) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1eca65-0002jH-UQ; Fri, 19 Jan 2018 10:04:59 -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> <87shb1de4a.fsf@xmission.com> <20180119165050.GK5612@ram.oc3035372033.ibm.com> Date: Fri, 19 Jan 2018 11:04:02 -0600 In-Reply-To: <20180119165050.GK5612@ram.oc3035372033.ibm.com> (Ram Pai's message of "Fri, 19 Jan 2018 08:50:50 -0800") Message-ID: <87efmldblp.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=1eca65-0002jH-UQ;;;mid=<87efmldblp.fsf@xmission.com>;;;hst=in01.mta.xmission.com;;;ip=97.121.73.102;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX1+keLcmL4GFuS7i7HSDxgqUi6u7v58yTAk= X-SA-Exim-Connect-IP: 97.121.73.102 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sa01.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.0 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.7 XMSubLong Long Subject * 0.0 TVD_RCVD_IP Message was received from an IP address * 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.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa01 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 0.0 T_TooManySym_03 6+ unique symbols in subject * 0.0 T_TooManySym_02 5+ unique symbols in subject X-Spam-DCC: XMission; sa01 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: *;Ram Pai X-Spam-Relay-Country: X-Spam-Timing: total 1633 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 3.1 (0.2%), b_tie_ro: 2.1 (0.1%), parse: 1.39 (0.1%), extract_message_metadata: 23 (1.4%), get_uri_detail_list: 20 (1.2%), tests_pri_-1000: 23 (1.4%), tests_pri_-950: 16 (1.0%), tests_pri_-900: 1.97 (0.1%), tests_pri_-400: 96 (5.9%), check_bayes: 94 (5.7%), b_tokenize: 33 (2.0%), b_tok_get_all: 27 (1.6%), b_comp_prob: 5 (0.3%), b_tok_touch_all: 11 (0.7%), b_finish: 0.83 (0.1%), tests_pri_0: 1408 (86.2%), check_dkim_signature: 0.86 (0.1%), check_dkim_adsp: 19 (1.1%), tests_pri_500: 8 (0.5%), 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 in01.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: > On Fri, Jan 19, 2018 at 10:09:41AM -0600, Eric W. Biederman wrote: >> 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? > > You mean something like this? > #define vma_pkey(vma) > It will lead to compilation error. > > > I can make it > #define vma_pkey(vma) 0 > > and that will work and get rid of the #ifdef Yes the second is what I was thinking. I don't know if it is worth it but #ifdefs can be problematic as the result in code not being compile tested. Eric