Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1686356

Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma

From Ram Pai <linuxram@us.ibm.com>
Newsgroups linux.kernel
Subject Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma
Date 2017-07-13 10:10 +0200
Message-ID <u2Hma-34F-25@gated-at.bofh.it> (permalink)
References <u001X-3kP-3@gated-at.bofh.it> <u001Y-3kP-27@gated-at.bofh.it> <u27Vp-5Hk-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 11, 2017 at 11:13:56AM -0700, Dave Hansen wrote:
> On 07/05/2017 02:22 PM, Ram Pai wrote:
> > +#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS
> > +void arch_show_smap(struct seq_file *m, struct vm_area_struct *vma)
> > +{
> > +	seq_printf(m, "ProtectionKey:  %8u\n", vma_pkey(vma));
> > +}
> > +#endif /* CONFIG_PPC64_MEMORY_PROTECTION_KEYS */
> 
> This seems like kinda silly unnecessary duplication.  Could we just put
> this in the fs/proc/ code and #ifdef it on ARCH_HAS_PKEYS?

Well x86 predicates it based on availability of X86_FEATURE_OSPKE.

powerpc doesn't need that check or any similar check. So trying to
generalize the code does not save much IMHO.

maybe have a seperate inline function that does
seq_printf(m, "ProtectionKey:  %8u\n", vma_pkey(vma));
and is called from x86 and powerpc's arch_show_smap()?
At least will keep the string format captured in 
one single place.

thoughts?
RP

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC v5 34/38] procfs: display the protection-key number associated with a vma Ram Pai <linuxram@us.ibm.com> - 2017-07-05 23:30 +0200
  Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2017-07-10 05:10 +0200
    Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Ram Pai <linuxram@us.ibm.com> - 2017-07-10 08:10 +0200
  Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Dave Hansen <dave.hansen@intel.com> - 2017-07-11 20:20 +0200
    Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Ram Pai <linuxram@us.ibm.com> - 2017-07-13 10:10 +0200
      Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Dave Hansen <dave.hansen@intel.com> - 2017-07-13 16:10 +0200
        Re: [RFC v5 34/38] procfs: display the protection-key number  associated with a vma Ram Pai <linuxram@us.ibm.com> - 2017-07-13 19:10 +0200

csiph-web