Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1681828 > unrolled thread
| Started by | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| First post | 2017-07-05 23:30 +0200 |
| Last post | 2017-07-13 19:10 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[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
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Date | 2017-07-05 23:30 +0200 |
| Subject | [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u001Y-3kP-27@gated-at.bofh.it> |
Display the pkey number associated with the vma in smaps of a task.
The key will be seen as below:
ProtectionKey: 0
Signed-off-by: Ram Pai <linuxram@us.ibm.com>
---
arch/powerpc/kernel/setup_64.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index f35ff9d..ebc82b3 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -37,6 +37,7 @@
#include <linux/memblock.h>
#include <linux/memory.h>
#include <linux/nmi.h>
+#include <linux/pkeys.h>
#include <asm/io.h>
#include <asm/kdump.h>
@@ -745,3 +746,10 @@ static int __init disable_hardlockup_detector(void)
}
early_initcall(disable_hardlockup_detector);
#endif
+
+#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 */
--
1.7.1
[toc] | [next] | [standalone]
| From | Anshuman Khandual <khandual@linux.vnet.ibm.com> |
|---|---|
| Date | 2017-07-10 05:10 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u1xfc-7Xt-9@gated-at.bofh.it> |
| In reply to | #1681828 |
On 07/06/2017 02:52 AM, Ram Pai wrote: > Display the pkey number associated with the vma in smaps of a task. > The key will be seen as below: > > ProtectionKey: 0 > > Signed-off-by: Ram Pai <linuxram@us.ibm.com> > --- > arch/powerpc/kernel/setup_64.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c > index f35ff9d..ebc82b3 100644 > --- a/arch/powerpc/kernel/setup_64.c > +++ b/arch/powerpc/kernel/setup_64.c > @@ -37,6 +37,7 @@ > #include <linux/memblock.h> > #include <linux/memory.h> > #include <linux/nmi.h> > +#include <linux/pkeys.h> > > #include <asm/io.h> > #include <asm/kdump.h> > @@ -745,3 +746,10 @@ static int __init disable_hardlockup_detector(void) > } > early_initcall(disable_hardlockup_detector); > #endif > + > +#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS Why not for X86 protection keys ?
[toc] | [prev] | [next] | [standalone]
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Date | 2017-07-10 08:10 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u1A3o-1hK-15@gated-at.bofh.it> |
| In reply to | #1683922 |
On Mon, Jul 10, 2017 at 08:37:28AM +0530, Anshuman Khandual wrote: > On 07/06/2017 02:52 AM, Ram Pai wrote: > > Display the pkey number associated with the vma in smaps of a task. > > The key will be seen as below: > > > > ProtectionKey: 0 > > > > Signed-off-by: Ram Pai <linuxram@us.ibm.com> > > --- > > arch/powerpc/kernel/setup_64.c | 8 ++++++++ > > 1 files changed, 8 insertions(+), 0 deletions(-) > > > > diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c > > index f35ff9d..ebc82b3 100644 > > --- a/arch/powerpc/kernel/setup_64.c > > +++ b/arch/powerpc/kernel/setup_64.c > > @@ -37,6 +37,7 @@ > > #include <linux/memblock.h> > > #include <linux/memory.h> > > #include <linux/nmi.h> > > +#include <linux/pkeys.h> > > > > #include <asm/io.h> > > #include <asm/kdump.h> > > @@ -745,3 +746,10 @@ static int __init disable_hardlockup_detector(void) > > } > > early_initcall(disable_hardlockup_detector); > > #endif > > + > > +#ifdef CONFIG_PPC64_MEMORY_PROTECTION_KEYS > > Why not for X86 protection keys ? hmm.. I dont understand the comment. -- Ram Pai
[toc] | [prev] | [next] | [standalone]
| From | Dave Hansen <dave.hansen@intel.com> |
|---|---|
| Date | 2017-07-11 20:20 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u27Vp-5Hk-15@gated-at.bofh.it> |
| In reply to | #1681828 |
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?
[toc] | [prev] | [next] | [standalone]
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Date | 2017-07-13 10:10 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u2Hma-34F-25@gated-at.bofh.it> |
| In reply to | #1685276 |
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
[toc] | [prev] | [next] | [standalone]
| From | Dave Hansen <dave.hansen@intel.com> |
|---|---|
| Date | 2017-07-13 16:10 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u2MYy-6BL-3@gated-at.bofh.it> |
| In reply to | #1686356 |
On 07/13/2017 01:03 AM, Ram Pai wrote:
> 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.
I know all your hardware doesn't support it. :)
So, for instance, if you are running on a new POWER9 with radix page
tables, you will just always output "ProtectionKey: 0" in every VMA,
regardless?
> 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.
Now that we have two architectures, is there a strong reason we can't
just have an arch_pkeys_enabled(), and stick the seq_printf() back in
generic code?
[toc] | [prev] | [next] | [standalone]
| From | Ram Pai <linuxram@us.ibm.com> |
|---|---|
| Date | 2017-07-13 19:10 +0200 |
| Subject | Re: [RFC v5 34/38] procfs: display the protection-key number associated with a vma |
| Message-ID | <u2PMK-8mJ-5@gated-at.bofh.it> |
| In reply to | #1686544 |
On Thu, Jul 13, 2017 at 07:07:48AM -0700, Dave Hansen wrote:
> On 07/13/2017 01:03 AM, Ram Pai wrote:
> > 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.
>
> I know all your hardware doesn't support it. :)
Wow! you bring a good point which I had not considered yet. I need some
runtime checks for RPT.
But regardless, my above statement is still partially true. x86
predicates it based on availability of X86_FEATURE_OSPKE, and powerpc
should predicate it based on HPT. So we have our own
customized checks. Hence a unified function won't suffice.
>
> So, for instance, if you are running on a new POWER9 with radix page
> tables, you will just always output "ProtectionKey: 0" in every VMA,
> regardless?
>
> > 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.
>
> Now that we have two architectures, is there a strong reason we can't
> just have an arch_pkeys_enabled(), and stick the seq_printf() back in
> generic code?
correct. that looks like the correct approach. Was trying to avoid
touching arch neutral code. But this approach will force me
do so. Will do.
--
Ram Pai
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web