* Re: [PATCH v8 4/6] mm: mlock: Add mlock flags to enable VM_LOCKONFAULT usage
From: Michal Hocko @ 2015-08-28 14:31 UTC (permalink / raw)
To: Eric B Munson
Cc: Andrew Morton, Vlastimil Babka, Jonathan Corbet,
Kirill A. Shutemov, linux-alpha, linux-kernel, linux-mips,
linux-parisc, linuxppc-dev, sparclinux, linux-xtensa, linux-arch,
linux-api, linux-mm
In-Reply-To: <1440613465-30393-5-git-send-email-emunson@akamai.com>
On Wed 26-08-15 14:24:23, Eric B Munson wrote:
> The previous patch introduced a flag that specified pages in a VMA
> should be placed on the unevictable LRU, but they should not be made
> present when the area is created. This patch adds the ability to set
> this state via the new mlock system calls.
>
> We add MLOCK_ONFAULT for mlock2 and MCL_ONFAULT for mlockall.
> MLOCK_ONFAULT will set the VM_LOCKONFAULT modifier for VM_LOCKED.
> MCL_ONFAULT should be used as a modifier to the two other mlockall
> flags. When used with MCL_CURRENT, all current mappings will be marked
> with VM_LOCKED | VM_LOCKONFAULT. When used with MCL_FUTURE, the
> mm->def_flags will be marked with VM_LOCKED | VM_LOCKONFAULT. When used
> with both MCL_CURRENT and MCL_FUTURE, all current mappings and
> mm->def_flags will be marked with VM_LOCKED | VM_LOCKONFAULT.
>
> Prior to this patch, mlockall() will unconditionally clear the
> mm->def_flags any time it is called without MCL_FUTURE. This behavior
> is maintained after adding MCL_ONFAULT. If a call to
> mlockall(MCL_FUTURE) is followed by mlockall(MCL_CURRENT), the
> mm->def_flags will be cleared and new VMAs will be unlocked. This
> remains true with or without MCL_ONFAULT in either mlockall()
> invocation.
>
> munlock() will unconditionally clear both vma flags. munlockall()
> unconditionally clears for VMA flags on all VMAs and in the
> mm->def_flags field.
>
> Signed-off-by: Eric B Munson <emunson@akamai.com>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Michal Hocko <mhocko@suse.cz>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
> Cc: linux-alpha@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-mips@linux-mips.org
> Cc: linux-parisc@vger.kernel.org
> Cc: linuxppc-dev@lists.ozlabs.org
> Cc: sparclinux@vger.kernel.org
> Cc: linux-xtensa@linux-xtensa.org
> Cc: linux-arch@vger.kernel.org
> Cc: linux-api@vger.kernel.org
> Cc: linux-mm@kvack.org
I haven't checked the arch specific bits but the core part looks good to
me.
Acked-by: Michal Hocko <mhocko@suse.com>
> ---
> arch/alpha/include/uapi/asm/mman.h | 3 ++
> arch/mips/include/uapi/asm/mman.h | 6 ++++
> arch/parisc/include/uapi/asm/mman.h | 3 ++
> arch/powerpc/include/uapi/asm/mman.h | 1 +
> arch/sparc/include/uapi/asm/mman.h | 1 +
> arch/tile/include/uapi/asm/mman.h | 1 +
> arch/xtensa/include/uapi/asm/mman.h | 6 ++++
> include/uapi/asm-generic/mman-common.h | 5 ++++
> include/uapi/asm-generic/mman.h | 1 +
> mm/mlock.c | 52 +++++++++++++++++++++++++---------
> 10 files changed, 66 insertions(+), 13 deletions(-)
>
> diff --git a/arch/alpha/include/uapi/asm/mman.h b/arch/alpha/include/uapi/asm/mman.h
> index 0086b47..f2f9496 100644
> --- a/arch/alpha/include/uapi/asm/mman.h
> +++ b/arch/alpha/include/uapi/asm/mman.h
> @@ -37,6 +37,9 @@
>
> #define MCL_CURRENT 8192 /* lock all currently mapped pages */
> #define MCL_FUTURE 16384 /* lock all additions to address space */
> +#define MCL_ONFAULT 32768 /* lock all pages that are faulted in */
> +
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
>
> #define MADV_NORMAL 0 /* no further special treatment */
> #define MADV_RANDOM 1 /* expect random page references */
> diff --git a/arch/mips/include/uapi/asm/mman.h b/arch/mips/include/uapi/asm/mman.h
> index cfcb876..97c03f4 100644
> --- a/arch/mips/include/uapi/asm/mman.h
> +++ b/arch/mips/include/uapi/asm/mman.h
> @@ -61,6 +61,12 @@
> */
> #define MCL_CURRENT 1 /* lock all current mappings */
> #define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
> +
> +/*
> + * Flags for mlock
> + */
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
>
> #define MADV_NORMAL 0 /* no further special treatment */
> #define MADV_RANDOM 1 /* expect random page references */
> diff --git a/arch/parisc/include/uapi/asm/mman.h b/arch/parisc/include/uapi/asm/mman.h
> index 294d251..ecc3ae1 100644
> --- a/arch/parisc/include/uapi/asm/mman.h
> +++ b/arch/parisc/include/uapi/asm/mman.h
> @@ -31,6 +31,9 @@
>
> #define MCL_CURRENT 1 /* lock all current mappings */
> #define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
> +
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
>
> #define MADV_NORMAL 0 /* no further special treatment */
> #define MADV_RANDOM 1 /* expect random page references */
> diff --git a/arch/powerpc/include/uapi/asm/mman.h b/arch/powerpc/include/uapi/asm/mman.h
> index 6ea26df..03c06ba 100644
> --- a/arch/powerpc/include/uapi/asm/mman.h
> +++ b/arch/powerpc/include/uapi/asm/mman.h
> @@ -22,6 +22,7 @@
>
> #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
> #define MCL_FUTURE 0x4000 /* lock all additions to address space */
> +#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */
>
> #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
> #define MAP_NONBLOCK 0x10000 /* do not block on IO */
> diff --git a/arch/sparc/include/uapi/asm/mman.h b/arch/sparc/include/uapi/asm/mman.h
> index 0b14df3..9765896 100644
> --- a/arch/sparc/include/uapi/asm/mman.h
> +++ b/arch/sparc/include/uapi/asm/mman.h
> @@ -17,6 +17,7 @@
>
> #define MCL_CURRENT 0x2000 /* lock all currently mapped pages */
> #define MCL_FUTURE 0x4000 /* lock all additions to address space */
> +#define MCL_ONFAULT 0x8000 /* lock all pages that are faulted in */
>
> #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
> #define MAP_NONBLOCK 0x10000 /* do not block on IO */
> diff --git a/arch/tile/include/uapi/asm/mman.h b/arch/tile/include/uapi/asm/mman.h
> index 81b8fc3..63ee13f 100644
> --- a/arch/tile/include/uapi/asm/mman.h
> +++ b/arch/tile/include/uapi/asm/mman.h
> @@ -36,6 +36,7 @@
> */
> #define MCL_CURRENT 1 /* lock all current mappings */
> #define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
>
>
> #endif /* _ASM_TILE_MMAN_H */
> diff --git a/arch/xtensa/include/uapi/asm/mman.h b/arch/xtensa/include/uapi/asm/mman.h
> index 201aec0..360944e 100644
> --- a/arch/xtensa/include/uapi/asm/mman.h
> +++ b/arch/xtensa/include/uapi/asm/mman.h
> @@ -74,6 +74,12 @@
> */
> #define MCL_CURRENT 1 /* lock all current mappings */
> #define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
> +
> +/*
> + * Flags for mlock
> + */
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
>
> #define MADV_NORMAL 0 /* no further special treatment */
> #define MADV_RANDOM 1 /* expect random page references */
> diff --git a/include/uapi/asm-generic/mman-common.h b/include/uapi/asm-generic/mman-common.h
> index ddc3b36..a74dd84 100644
> --- a/include/uapi/asm-generic/mman-common.h
> +++ b/include/uapi/asm-generic/mman-common.h
> @@ -25,6 +25,11 @@
> # define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
> #endif
>
> +/*
> + * Flags for mlock
> + */
> +#define MLOCK_ONFAULT 0x01 /* Lock pages in range after they are faulted in, do not prefault */
> +
> #define MS_ASYNC 1 /* sync memory asynchronously */
> #define MS_INVALIDATE 2 /* invalidate the caches */
> #define MS_SYNC 4 /* synchronous memory sync */
> diff --git a/include/uapi/asm-generic/mman.h b/include/uapi/asm-generic/mman.h
> index e9fe6fd..7162cd4 100644
> --- a/include/uapi/asm-generic/mman.h
> +++ b/include/uapi/asm-generic/mman.h
> @@ -17,5 +17,6 @@
>
> #define MCL_CURRENT 1 /* lock all current mappings */
> #define MCL_FUTURE 2 /* lock all future mappings */
> +#define MCL_ONFAULT 4 /* lock all pages that are faulted in */
>
> #endif /* __ASM_GENERIC_MMAN_H */
> diff --git a/mm/mlock.c b/mm/mlock.c
> index 7efe27d..0747663 100644
> --- a/mm/mlock.c
> +++ b/mm/mlock.c
> @@ -506,7 +506,8 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev,
>
> if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) ||
> is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm))
> - goto out; /* don't set VM_LOCKED, don't count */
> + /* don't set VM_LOCKED or VM_LOCKONFAULT and don't count */
> + goto out;
>
> pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT);
> *prev = vma_merge(mm, *prev, start, end, newflags, vma->anon_vma,
> @@ -576,7 +577,7 @@ static int apply_vma_lock_flags(unsigned long start, size_t len,
> prev = vma;
>
> for (nstart = start ; ; ) {
> - vm_flags_t newflags = vma->vm_flags & ~VM_LOCKED;
> + vm_flags_t newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
>
> newflags |= flags;
>
> @@ -645,10 +646,15 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)
>
> SYSCALL_DEFINE3(mlock2, unsigned long, start, size_t, len, int, flags)
> {
> - if (flags)
> + vm_flags_t vm_flags = VM_LOCKED;
> +
> + if (flags & ~MLOCK_ONFAULT)
> return -EINVAL;
>
> - return do_mlock(start, len, VM_LOCKED);
> + if (flags & MLOCK_ONFAULT)
> + vm_flags |= VM_LOCKONFAULT;
> +
> + return do_mlock(start, len, vm_flags);
> }
>
> SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
> @@ -665,24 +671,43 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len)
> return ret;
> }
>
> +/*
> + * Take the MCL_* flags passed into mlockall (or 0 if called from munlockall)
> + * and translate into the appropriate modifications to mm->def_flags and/or the
> + * flags for all current VMAs.
> + *
> + * There are a couple of subtleties with this. If mlockall() is called multiple
> + * times with different flags, the values do not necessarily stack. If mlockall
> + * is called once including the MCL_FUTURE flag and then a second time without
> + * it, VM_LOCKED and VM_LOCKONFAULT will be cleared from mm->def_flags.
> + */
> static int apply_mlockall_flags(int flags)
> {
> struct vm_area_struct * vma, * prev = NULL;
> + vm_flags_t to_add = 0;
>
> - if (flags & MCL_FUTURE)
> + current->mm->def_flags &= VM_LOCKED_CLEAR_MASK;
> + if (flags & MCL_FUTURE) {
> current->mm->def_flags |= VM_LOCKED;
> - else
> - current->mm->def_flags &= ~VM_LOCKED;
>
> - if (flags == MCL_FUTURE)
> - goto out;
> + if (flags & MCL_ONFAULT)
> + current->mm->def_flags |= VM_LOCKONFAULT;
> +
> + if (!(flags & MCL_CURRENT))
> + goto out;
> + }
> +
> + if (flags & MCL_CURRENT) {
> + to_add |= VM_LOCKED;
> + if (flags & MCL_ONFAULT)
> + to_add |= VM_LOCKONFAULT;
> + }
>
> for (vma = current->mm->mmap; vma ; vma = prev->vm_next) {
> vm_flags_t newflags;
>
> - newflags = vma->vm_flags & ~VM_LOCKED;
> - if (flags & MCL_CURRENT)
> - newflags |= VM_LOCKED;
> + newflags = vma->vm_flags & VM_LOCKED_CLEAR_MASK;
> + newflags |= to_add;
>
> /* Ignore errors */
> mlock_fixup(vma, &prev, vma->vm_start, vma->vm_end, newflags);
> @@ -697,7 +722,8 @@ SYSCALL_DEFINE1(mlockall, int, flags)
> unsigned long lock_limit;
> int ret = -EINVAL;
>
> - if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE)))
> + if (!flags || (flags & ~(MCL_CURRENT | MCL_FUTURE | MCL_ONFAULT)) ||
> + flags == MCL_ONFAULT)
> goto out;
>
> ret = -EPERM;
> --
> 1.9.1
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [PATCH v8 3/6] mm: Introduce VM_LOCKONFAULT
From: Michal Hocko @ 2015-08-28 14:18 UTC (permalink / raw)
To: Eric B Munson
Cc: Andrew Morton, Vlastimil Babka, Jonathan Corbet,
Kirill A. Shutemov, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mm-Bw31MaZKKs3YtjvyW6yDsg, linux-api-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1440613465-30393-4-git-send-email-emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>
On Wed 26-08-15 14:24:22, Eric B Munson wrote:
> The cost of faulting in all memory to be locked can be very high when
> working with large mappings. If only portions of the mapping will be
> used this can incur a high penalty for locking.
>
> For the example of a large file, this is the usage pattern for a large
> statical language model (probably applies to other statical or graphical
> models as well). For the security example, any application transacting
> in data that cannot be swapped out (credit card data, medical records,
> etc).
>
> This patch introduces the ability to request that pages are not
> pre-faulted, but are placed on the unevictable LRU when they are finally
> faulted in. The VM_LOCKONFAULT flag will be used together with
> VM_LOCKED and has no effect when set without VM_LOCKED. Setting the
> VM_LOCKONFAULT flag for a VMA will cause pages faulted into that VMA to
> be added to the unevictable LRU when they are faulted or if they are
> already present, but will not cause any missing pages to be faulted in.
OK, I can live with this. Thank you for removing the part which exports
the flag to the userspace.
> Exposing this new lock state means that we cannot overload the meaning
> of the FOLL_POPULATE flag any longer. Prior to this patch it was used
> to mean that the VMA for a fault was locked. This means we need the
> new FOLL_MLOCK flag to communicate the locked state of a VMA.
> FOLL_POPULATE will now only control if the VMA should be populated and
> in the case of VM_LOCKONFAULT, it will not be set.
I thinking that this part is really unnecessary. populate_vma_page_range
could have simply returned without calling gup for VM_LOCKONFAULT
vmas. You would save the pte walk and the currently mapped pages would
be still protected from the reclaim. The side effect would be that they
would litter the regular LRUs and mlock/unevictable counters wouldn't be
updated until those pages are encountered during the reclaim and culled
to unevictable list.
I would expect that mlock with this flag would be typically called
on mostly unpopulated mappings so the side effects would be barely
noticeable while the lack of pte walk would be really nice (especially
for the large mappings).
This would be a nice optimization and minor code reduction but I am not
going to insist on it. I will leave the decision to you.
> Signed-off-by: Eric B Munson <emunson-JqFfY2XvxFXQT0dZR+AlfA@public.gmane.org>
> Cc: Michal Hocko <mhocko-AlSwsSmVLrQ@public.gmane.org>
> Cc: Vlastimil Babka <vbabka-AlSwsSmVLrQ@public.gmane.org>
> Cc: Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>
> Cc: "Kirill A. Shutemov" <kirill-oKw7cIdHH8eLwutG50LtGA@public.gmane.org>
> Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Cc: linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org
> Cc: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Acked-by: Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>
One note below:
> ---
> Changes from v7:
> *Drop entries in smaps and dri code to avoid exposing VM_LOCKONFAULT to
> userspace. VM_LOCKONFAULT is still exposed via mm/debug.c
> *Create VM_LOCKED_CLEAR_MASK to be used anywhere we want to clear all
> flags relating to locked VMAs
>
> include/linux/mm.h | 5 +++++
> kernel/fork.c | 2 +-
> mm/debug.c | 1 +
> mm/gup.c | 10 ++++++++--
> mm/huge_memory.c | 2 +-
> mm/hugetlb.c | 4 ++--
> mm/mlock.c | 2 +-
> mm/mmap.c | 2 +-
> mm/rmap.c | 6 ++++--
> 9 files changed, 24 insertions(+), 10 deletions(-)
[...]
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 171b687..14ce002 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -744,7 +744,8 @@ static int page_referenced_one(struct page *page, struct vm_area_struct *vma,
>
> if (vma->vm_flags & VM_LOCKED) {
> spin_unlock(ptl);
> - pra->vm_flags |= VM_LOCKED;
> + pra->vm_flags |=
> + (vma->vm_flags & (VM_LOCKED | VM_LOCKONFAULT));
> return SWAP_FAIL; /* To break the loop */
> }
>
> @@ -765,7 +766,8 @@ static int page_referenced_one(struct page *page, struct vm_area_struct *vma,
>
> if (vma->vm_flags & VM_LOCKED) {
> pte_unmap_unlock(pte, ptl);
> - pra->vm_flags |= VM_LOCKED;
> + pra->vm_flags |=
> + (vma->vm_flags & (VM_LOCKED | VM_LOCKONFAULT));
> return SWAP_FAIL; /* To break the loop */
> }
Why do we need to export this? Neither of the consumers care and should
care. VM_LOCKONFAULT should never be set without VM_LOCKED which is the
only thing that we should care about.
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [RFC PATCH 4/9] mips: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-28 14:06 UTC (permalink / raw)
To: Ralf Baechle
Cc: Andrew Morton, linux-api, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mips-6z/3iImG2C8G8FEW9MqTrA
In-Reply-To: <20150828074034.GA22604-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
----- On Aug 28, 2015, at 3:40 AM, Ralf Baechle ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org wrote:
> On Thu, Aug 27, 2015 at 01:56:50PM -0400, Mathieu Desnoyers wrote:
>
>> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
>> apply this patch, build/run a membarrier-enabled kernel, and do make
>> kselftest. ]
>>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
>> CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> CC: Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
>> CC: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org
>> ---
>> arch/mips/include/uapi/asm/unistd.h | 15 +++++++++------
>> arch/mips/kernel/scall32-o32.S | 1 +
>> arch/mips/kernel/scall64-64.S | 1 +
>> arch/mips/kernel/scall64-n32.S | 1 +
>> arch/mips/kernel/scall64-o32.S | 1 +
>> 5 files changed, 13 insertions(+), 6 deletions(-)
>
> Looking good assuming there is no compat syscall required.
Indeed, sys_membarrier only takes two integer arguments, so no
compat syscall is required.
Thanks!
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [RFC PATCH 4/9] mips: allocate sys_membarrier system call number
From: Ralf Baechle @ 2015-08-28 7:40 UTC (permalink / raw)
To: Mathieu Desnoyers
Cc: Andrew Morton, linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-mips-6z/3iImG2C8G8FEW9MqTrA
In-Reply-To: <1440698215-8355-5-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
On Thu, Aug 27, 2015 at 01:56:50PM -0400, Mathieu Desnoyers wrote:
> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
> apply this patch, build/run a membarrier-enabled kernel, and do make
> kselftest. ]
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
> CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> CC: Ralf Baechle <ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org>
> CC: linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org
> ---
> arch/mips/include/uapi/asm/unistd.h | 15 +++++++++------
> arch/mips/kernel/scall32-o32.S | 1 +
> arch/mips/kernel/scall64-64.S | 1 +
> arch/mips/kernel/scall64-n32.S | 1 +
> arch/mips/kernel/scall64-o32.S | 1 +
> 5 files changed, 13 insertions(+), 6 deletions(-)
Looking good assuming there is no compat syscall required.
Ralf
^ permalink raw reply
* Re: [RFC PATCH 2/9] arm: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 23:16 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: Andrew Morton, linux-api, linux-kernel-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20150827225147.GG21084-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
----- On Aug 27, 2015, at 6:51 PM, Russell King - ARM Linux linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org wrote:
> On Thu, Aug 27, 2015 at 01:56:48PM -0400, Mathieu Desnoyers wrote:
>> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
>> apply this patch, build/run a membarrier-enabled kernel, and do make
>> kselftest. ]
>
> But note: the system call is not guaranteed to be allocated at that number
> until I've merged the patch. I believe that there's other system calls
> which are pending during the next merge window.
Sure, no problem. I mainly want to make sure the system call
works fine on each major arch before we reach the merge window.
Let me know if you want me to send an updated version of this
patch during or after the merge window.
Thanks!
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [RFC PATCH 6/9] sparc/sparc64: allocate sys_membarrier system call number
From: David Miller @ 2015-08-27 23:16 UTC (permalink / raw)
To: mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w
Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
sparclinux-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <1440698215-8355-7-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
From: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
Date: Thu, 27 Aug 2015 13:56:52 -0400
> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
> apply this patch, build/run a membarrier-enabled kernel, and do make
> kselftest. ]
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
Acked-by: David S. Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>
^ permalink raw reply
* Re: [RFC PATCH 2/9] arm: allocate sys_membarrier system call number
From: Russell King - ARM Linux @ 2015-08-27 22:51 UTC (permalink / raw)
To: Mathieu Desnoyers; +Cc: Andrew Morton, linux-api, linux-kernel
In-Reply-To: <1440698215-8355-3-git-send-email-mathieu.desnoyers@efficios.com>
On Thu, Aug 27, 2015 at 01:56:48PM -0400, Mathieu Desnoyers wrote:
> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
> apply this patch, build/run a membarrier-enabled kernel, and do make
> kselftest. ]
But note: the system call is not guaranteed to be allocated at that number
until I've merged the patch. I believe that there's other system calls
which are pending during the next merge window.
--
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
^ permalink raw reply
* [RFC PATCH v2] alpha: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 19:07 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Richard Henderson,
Ivan Kokshaysky, Matt Turner, linux-alpha
In-Reply-To: <CAEdQ38HvhvcbmV_zCi=hHBnx7OnuHgX_SvvhEFjs+-hYYaDa_w@mail.gmail.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Richard Henderson <rth@twiddle.net>
CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
CC: Matt Turner <mattst88@gmail.com>
CC: linux-alpha@vger.kernel.org
---
arch/alpha/include/asm/unistd.h | 2 +-
arch/alpha/include/uapi/asm/unistd.h | 1 +
arch/alpha/kernel/systbls.S | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h
index a56e608..07aa4ca 100644
--- a/arch/alpha/include/asm/unistd.h
+++ b/arch/alpha/include/asm/unistd.h
@@ -3,7 +3,7 @@
#include <uapi/asm/unistd.h>
-#define NR_SYSCALLS 514
+#define NR_SYSCALLS 515
#define __ARCH_WANT_OLD_READDIR
#define __ARCH_WANT_STAT64
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index aa33bf5..7725619 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -475,5 +475,6 @@
#define __NR_getrandom 511
#define __NR_memfd_create 512
#define __NR_execveat 513
+#define __NR_membarrier 514
#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 9b62e3f..1ea64f4 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -532,6 +532,7 @@ sys_call_table:
.quad sys_getrandom
.quad sys_memfd_create
.quad sys_execveat
+ .quad sys_membarrier
.size sys_call_table, . - sys_call_table
.type sys_call_table, @object
--
1.9.1
^ permalink raw reply related
* Re: [RFC PATCH 7/9] alpha: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 19:06 UTC (permalink / raw)
To: Matt Turner
Cc: Andrew Morton, linux-api, LKML, Richard Henderson,
Ivan Kokshaysky, linux-alpha
In-Reply-To: <CAEdQ38HvhvcbmV_zCi=hHBnx7OnuHgX_SvvhEFjs+-hYYaDa_w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
----- On Aug 27, 2015, at 2:34 PM, Matt Turner mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> On Thu, Aug 27, 2015 at 10:56 AM, Mathieu Desnoyers
> <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org> wrote:
>> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
>> apply this patch, build/run a membarrier-enabled kernel, and do make
>> kselftest. ]
>>
>> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
>> CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
>> CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> CC: Richard Henderson <rth-hL46jP5Bxq7R7s880joybQ@public.gmane.org>
>> CC: Ivan Kokshaysky <ink-biIs/Y0ymYJMZLIVYojuPNP0rXTJTi09@public.gmane.org>
>> CC: Matt Turner <mattst88-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>> CC: linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> ---
>> arch/alpha/include/uapi/asm/unistd.h | 1 +
>> arch/alpha/kernel/systbls.S | 1 +
>> 2 files changed, 2 insertions(+)
>>
>> diff --git a/arch/alpha/include/uapi/asm/unistd.h
>> b/arch/alpha/include/uapi/asm/unistd.h
>> index aa33bf5..7725619 100644
>> --- a/arch/alpha/include/uapi/asm/unistd.h
>> +++ b/arch/alpha/include/uapi/asm/unistd.h
>> @@ -475,5 +475,6 @@
>> #define __NR_getrandom 511
>> #define __NR_memfd_create 512
>> #define __NR_execveat 513
>> +#define __NR_membarrier 514
>
> NR_SYSCALLS in arch/alpha/include/asm/unistd.h needs to be updated as well.
>
Will send a v2 with this modif, thanks!
Mathieu
>>
>> #endif /* _UAPI_ALPHA_UNISTD_H */
>> diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
>> index 9b62e3f..1ea64f4 100644
>> --- a/arch/alpha/kernel/systbls.S
>> +++ b/arch/alpha/kernel/systbls.S
>> @@ -532,6 +532,7 @@ sys_call_table:
>> .quad sys_getrandom
>> .quad sys_memfd_create
>> .quad sys_execveat
>> + .quad sys_membarrier
>>
>> .size sys_call_table, . - sys_call_table
>> .type sys_call_table, @object
>> --
>> 1.9.1
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [RFC PATCH 7/9] alpha: allocate sys_membarrier system call number
From: Matt Turner @ 2015-08-27 18:34 UTC (permalink / raw)
To: Mathieu Desnoyers
Cc: Andrew Morton, linux-api, LKML, Richard Henderson,
Ivan Kokshaysky, linux-alpha
In-Reply-To: <1440698215-8355-8-git-send-email-mathieu.desnoyers@efficios.com>
On Thu, Aug 27, 2015 at 10:56 AM, Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
> [ Untested on this architecture. To try it out: fetch linux-next/akpm,
> apply this patch, build/run a membarrier-enabled kernel, and do make
> kselftest. ]
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> CC: Andrew Morton <akpm@linux-foundation.org>
> CC: linux-api@vger.kernel.org
> CC: Richard Henderson <rth@twiddle.net>
> CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
> CC: Matt Turner <mattst88@gmail.com>
> CC: linux-alpha@vger.kernel.org
> ---
> arch/alpha/include/uapi/asm/unistd.h | 1 +
> arch/alpha/kernel/systbls.S | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
> index aa33bf5..7725619 100644
> --- a/arch/alpha/include/uapi/asm/unistd.h
> +++ b/arch/alpha/include/uapi/asm/unistd.h
> @@ -475,5 +475,6 @@
> #define __NR_getrandom 511
> #define __NR_memfd_create 512
> #define __NR_execveat 513
> +#define __NR_membarrier 514
NR_SYSCALLS in arch/alpha/include/asm/unistd.h needs to be updated as well.
>
> #endif /* _UAPI_ALPHA_UNISTD_H */
> diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
> index 9b62e3f..1ea64f4 100644
> --- a/arch/alpha/kernel/systbls.S
> +++ b/arch/alpha/kernel/systbls.S
> @@ -532,6 +532,7 @@ sys_call_table:
> .quad sys_getrandom
> .quad sys_memfd_create
> .quad sys_execveat
> + .quad sys_membarrier
>
> .size sys_call_table, . - sys_call_table
> .type sys_call_table, @object
> --
> 1.9.1
>
^ permalink raw reply
* Best regards, TO NEXT OF KIN.........
From: Ben cook @ 2015-08-27 18:32 UTC (permalink / raw)
Barrister Ben Cook
La Sagrada Familia Calle Mallorca,
601 08713 Seville Spain.
Mobil: +34 631 093 714
> Attn: Dear Friend,
>
I am Barrister Ben Cook a solicitor at law. I am the personal attorney to late Mr. Robert a national of your country, who was an official contractor (category D) with REPSOL YPF, SPAIN (RY) an oil firm in Spain. Here in after shall be referred to as my client. On the 11th of March 2010, my client, his wife and their two only sons were involved in a car accident on holiday trip along Las Palmas express way. All occupants of the vehicle unfortunately lost their lives. Since then I have made several enquiries and presentations to locate any of my client's extended relatives, this has also proved abortive. It is after these several unsuccessful attempts to locate any member of his family failed that I decided to contact you since coincidentally you have your last name believing that you can in
variably be of help in this situation to stands as the next of kin to this my client. I am contacting you to assist in repatriating the money and property left behind by my client before th!
!ey get confiscated or declared uns
>
Already, the finance company where the deceased had an account valued at about 1 Million Euros has issued me a notice/ultimatum to provide the next of kin or have the account confiscated within the next one Month. Since It has been unsuccessful in locating the relatives for over 2 years now, I seek your consent to present you as the next of kin of the deceased, so that the proceeds of this account valued at 1 Million Euros can be paid to your account and there after we can share the fund (money) in the ratio of 7:3. That is, I will have 70% of the proceed while you have 30% for your assistance. I have all necessary legal documents that can be used to back up any claim we may make. All I require is your honest co-operation to enable us see this transaction through .I guarantee that this wil
l be executed under a legitimate arrangement that will protect you from any breach of the law.
Please get in touch with me by my email and send to me your telephone and fax numbers to enable us discuss further about this transaction.
>
Best regards,
Barrister Ben Cook
=============MAX=============
^ permalink raw reply
* [RFC PATCH 9/9] parisc: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, James E.J. Bottomley,
Helge Deller, linux-parisc
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: "James E.J. Bottomley" <jejb@parisc-linux.org>
CC: Helge Deller <deller@gmx.de>
CC: linux-parisc@vger.kernel.org
---
arch/parisc/include/uapi/asm/unistd.h | 3 ++-
arch/parisc/kernel/syscall_table.S | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 2e639d7..dadcada 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -358,8 +358,9 @@
#define __NR_memfd_create (__NR_Linux + 340)
#define __NR_bpf (__NR_Linux + 341)
#define __NR_execveat (__NR_Linux + 342)
+#define __NR_membarrier (__NR_Linux + 343)
-#define __NR_Linux_syscalls (__NR_execveat + 1)
+#define __NR_Linux_syscalls (__NR_membarrier + 1)
#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 8eefb12..2faa43b 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -438,6 +438,7 @@
ENTRY_SAME(memfd_create) /* 340 */
ENTRY_SAME(bpf)
ENTRY_COMP(execveat)
+ ENTRY_COMP(membarrier)
.ifne (. - 90b) - (__NR_Linux_syscalls * (91b - 90b))
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 8/9] ia64: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Tony Luck, Fenghua Yu,
linux-ia64
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Tony Luck <tony.luck@intel.com>
CC: Fenghua Yu <fenghua.yu@intel.com>
CC: linux-ia64@vger.kernel.org
---
arch/ia64/include/asm/unistd.h | 2 +-
arch/ia64/include/uapi/asm/unistd.h | 1 +
arch/ia64/kernel/entry.S | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/ia64/include/asm/unistd.h b/arch/ia64/include/asm/unistd.h
index 95c39b9..1d54e17 100644
--- a/arch/ia64/include/asm/unistd.h
+++ b/arch/ia64/include/asm/unistd.h
@@ -11,7 +11,7 @@
-#define NR_syscalls 319 /* length of syscall table */
+#define NR_syscalls 320 /* length of syscall table */
/*
* The following defines stop scripts/checksyscalls.sh from complaining about
diff --git a/arch/ia64/include/uapi/asm/unistd.h b/arch/ia64/include/uapi/asm/unistd.h
index 4610795..b7aae55 100644
--- a/arch/ia64/include/uapi/asm/unistd.h
+++ b/arch/ia64/include/uapi/asm/unistd.h
@@ -332,5 +332,6 @@
#define __NR_memfd_create 1340
#define __NR_bpf 1341
#define __NR_execveat 1342
+#define __NR_membarrier 1343
#endif /* _UAPI_ASM_IA64_UNISTD_H */
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index ae0de7b..1ce01f9 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1768,5 +1768,6 @@ sys_call_table:
data8 sys_memfd_create // 1340
data8 sys_bpf
data8 sys_execveat
+ data8 sys_membarrier
.org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 7/9] alpha: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Richard Henderson,
Ivan Kokshaysky, Matt Turner, linux-alpha
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Richard Henderson <rth@twiddle.net>
CC: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
CC: Matt Turner <mattst88@gmail.com>
CC: linux-alpha@vger.kernel.org
---
arch/alpha/include/uapi/asm/unistd.h | 1 +
arch/alpha/kernel/systbls.S | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index aa33bf5..7725619 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -475,5 +475,6 @@
#define __NR_getrandom 511
#define __NR_memfd_create 512
#define __NR_execveat 513
+#define __NR_membarrier 514
#endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 9b62e3f..1ea64f4 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -532,6 +532,7 @@ sys_call_table:
.quad sys_getrandom
.quad sys_memfd_create
.quad sys_execveat
+ .quad sys_membarrier
.size sys_call_table, . - sys_call_table
.type sys_call_table, @object
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 6/9] sparc/sparc64: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, David S. Miller, sparclinux
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: "David S. Miller" <davem@davemloft.net>
CC: sparclinux@vger.kernel.org
---
arch/sparc/include/uapi/asm/unistd.h | 3 ++-
arch/sparc/kernel/systbls_32.S | 2 +-
arch/sparc/kernel/systbls_64.S | 4 ++--
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/sparc/include/uapi/asm/unistd.h b/arch/sparc/include/uapi/asm/unistd.h
index 6f35f4d..efe9479 100644
--- a/arch/sparc/include/uapi/asm/unistd.h
+++ b/arch/sparc/include/uapi/asm/unistd.h
@@ -416,8 +416,9 @@
#define __NR_memfd_create 348
#define __NR_bpf 349
#define __NR_execveat 350
+#define __NR_membarrier 351
-#define NR_syscalls 351
+#define NR_syscalls 352
/* Bitmask values returned from kern_features system call. */
#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index e31a905..cc23b62 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -87,4 +87,4 @@ sys_call_table:
/*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
/*340*/ .long sys_ni_syscall, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
/*345*/ .long sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
-/*350*/ .long sys_execveat
+/*350*/ .long sys_execveat, sys_membarrier
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index d72f76a..f229468 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -88,7 +88,7 @@ sys_call_table32:
.word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
.word sys32_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
-/*350*/ .word sys32_execveat
+/*350*/ .word sys32_execveat, sys_membarrier
#endif /* CONFIG_COMPAT */
@@ -168,4 +168,4 @@ sys_call_table:
.word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
/*340*/ .word sys_kern_features, sys_kcmp, sys_finit_module, sys_sched_setattr, sys_sched_getattr
.word sys_renameat2, sys_seccomp, sys_getrandom, sys_memfd_create, sys_bpf
-/*350*/ .word sys64_execveat
+/*350*/ .word sys64_execveat, sys_membarrier
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 5/9] s390/s390x: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Martin Schwidefsky,
Heiko Carstens, linux-s390
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Martin Schwidefsky <schwidefsky@de.ibm.com>
CC: Heiko Carstens <heiko.carstens@de.ibm.com>
CC: linux-s390@vger.kernel.org
---
arch/s390/include/uapi/asm/unistd.h | 3 ++-
arch/s390/kernel/syscalls.S | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/s390/include/uapi/asm/unistd.h b/arch/s390/include/uapi/asm/unistd.h
index 59d2bb4..2f1de70 100644
--- a/arch/s390/include/uapi/asm/unistd.h
+++ b/arch/s390/include/uapi/asm/unistd.h
@@ -290,7 +290,8 @@
#define __NR_s390_pci_mmio_write 352
#define __NR_s390_pci_mmio_read 353
#define __NR_execveat 354
-#define NR_syscalls 355
+#define __NR_membarrier 355
+#define NR_syscalls 356
/*
* There are some system calls that are not present on 64 bit, some
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S
index f3f4a13..914c098 100644
--- a/arch/s390/kernel/syscalls.S
+++ b/arch/s390/kernel/syscalls.S
@@ -363,3 +363,4 @@ SYSCALL(sys_bpf,compat_sys_bpf)
SYSCALL(sys_s390_pci_mmio_write,compat_sys_s390_pci_mmio_write)
SYSCALL(sys_s390_pci_mmio_read,compat_sys_s390_pci_mmio_read)
SYSCALL(sys_execveat,compat_sys_execveat)
+SYSCALL(sys_membarrier,sys_membarrier)
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 4/9] mips: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Ralf Baechle, linux-mips
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
---
arch/mips/include/uapi/asm/unistd.h | 15 +++++++++------
arch/mips/kernel/scall32-o32.S | 1 +
arch/mips/kernel/scall64-64.S | 1 +
arch/mips/kernel/scall64-n32.S | 1 +
arch/mips/kernel/scall64-o32.S | 1 +
5 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/arch/mips/include/uapi/asm/unistd.h b/arch/mips/include/uapi/asm/unistd.h
index d0bdfaa..b107983 100644
--- a/arch/mips/include/uapi/asm/unistd.h
+++ b/arch/mips/include/uapi/asm/unistd.h
@@ -378,16 +378,17 @@
#define __NR_bpf (__NR_Linux + 355)
#define __NR_execveat (__NR_Linux + 356)
#define __NR_mlock2 (__NR_Linux + 357)
+#define __NR_membarrier (__NR_Linux + 358)
/*
* Offset of the last Linux o32 flavoured syscall
*/
-#define __NR_Linux_syscalls 357
+#define __NR_Linux_syscalls 358
#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
#define __NR_O32_Linux 4000
-#define __NR_O32_Linux_syscalls 357
+#define __NR_O32_Linux_syscalls 358
#if _MIPS_SIM == _MIPS_SIM_ABI64
@@ -713,16 +714,17 @@
#define __NR_bpf (__NR_Linux + 315)
#define __NR_execveat (__NR_Linux + 316)
#define __NR_mlock2 (__NR_Linux + 317)
+#define __NR_membarrier (__NR_Linux + 318)
/*
* Offset of the last Linux 64-bit flavoured syscall
*/
-#define __NR_Linux_syscalls 317
+#define __NR_Linux_syscalls 318
#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
#define __NR_64_Linux 5000
-#define __NR_64_Linux_syscalls 317
+#define __NR_64_Linux_syscalls 318
#if _MIPS_SIM == _MIPS_SIM_NABI32
@@ -1052,15 +1054,16 @@
#define __NR_bpf (__NR_Linux + 319)
#define __NR_execveat (__NR_Linux + 320)
#define __NR_mlock2 (__NR_Linux + 321)
+#define __NR_membarrier (__NR_Linux + 322)
/*
* Offset of the last N32 flavoured syscall
*/
-#define __NR_Linux_syscalls 321
+#define __NR_Linux_syscalls 322
#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
#define __NR_N32_Linux 6000
-#define __NR_N32_Linux_syscalls 321
+#define __NR_N32_Linux_syscalls 322
#endif /* _UAPI_ASM_UNISTD_H */
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index b0b377a..9265542 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -600,3 +600,4 @@ EXPORT(sys_call_table)
PTR sys_bpf /* 4355 */
PTR sys_execveat
PTR sys_mlock2
+ PTR sys_membarrier
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index f12eb03..79d4fb0 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -437,4 +437,5 @@ EXPORT(sys_call_table)
PTR sys_bpf /* 5315 */
PTR sys_execveat
PTR sys_mlock2
+ PTR sys_membarrier
.size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index ecdd65a..235892a 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -430,4 +430,5 @@ EXPORT(sysn32_call_table)
PTR sys_bpf
PTR compat_sys_execveat /* 6320 */
PTR sys_mlock2
+ PTR sys_membarrier
.size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 7a8b2df..c051bd3 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -585,4 +585,5 @@ EXPORT(sys32_call_table)
PTR sys_bpf /* 4355 */
PTR compat_sys_execveat
PTR sys_mlock2
+ PTR sys_membarrier
.size sys32_call_table,.-sys32_call_table
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 3/9] arm64: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Catalin Marinas, Will Deacon
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
arm64 sys_membarrier number is already wired for arm64 through
asm-generic/unistd.h, but needs to be allocated separately for
the 32-bit compability layer of arm64.
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Catalin Marinas <catalin.marinas@arm.com>
CC: Will Deacon <will.deacon@arm.com>
---
arch/arm64/include/asm/unistd32.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm64/include/asm/unistd32.h b/arch/arm64/include/asm/unistd32.h
index cef934a..d97be80 100644
--- a/arch/arm64/include/asm/unistd32.h
+++ b/arch/arm64/include/asm/unistd32.h
@@ -797,3 +797,5 @@ __SYSCALL(__NR_memfd_create, sys_memfd_create)
__SYSCALL(__NR_bpf, sys_bpf)
#define __NR_execveat 387
__SYSCALL(__NR_execveat, compat_sys_execveat)
+#define __NR_membarrier 388
+__SYSCALL(__NR_membarrier, sys_membarrier)
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 2/9] arm: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api-u79uwXL29TY76Z2rM5mHXA
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Mathieu Desnoyers,
Russell King
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers-vg+e7yoeK/dWk0Htik3J/w@public.gmane.org>
CC: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
CC: linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
CC: Russell King <linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
---
arch/arm/include/asm/unistd.h | 2 +-
arch/arm/include/uapi/asm/unistd.h | 1 +
arch/arm/kernel/calls.S | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 32640c4..d93876c 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -19,7 +19,7 @@
* This may need to be greater than __NR_last_syscall+1 in order to
* account for the padding in the syscall table
*/
-#define __NR_syscalls (388)
+#define __NR_syscalls (389)
/*
* *NOTE*: This is a ghost syscall private to the kernel. Only the
diff --git a/arch/arm/include/uapi/asm/unistd.h b/arch/arm/include/uapi/asm/unistd.h
index 0c3f5a0..436bb32 100644
--- a/arch/arm/include/uapi/asm/unistd.h
+++ b/arch/arm/include/uapi/asm/unistd.h
@@ -414,6 +414,7 @@
#define __NR_memfd_create (__NR_SYSCALL_BASE+385)
#define __NR_bpf (__NR_SYSCALL_BASE+386)
#define __NR_execveat (__NR_SYSCALL_BASE+387)
+#define __NR_membarrier (__NR_SYSCALL_BASE+388)
/*
* The following SWIs are ARM private.
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 05745eb..310699c 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -397,6 +397,7 @@
/* 385 */ CALL(sys_memfd_create)
CALL(sys_bpf)
CALL(sys_execveat)
+ CALL(sys_membarrier)
#ifndef syscalls_counted
.equ syscalls_padding, ((NR_syscalls + 3) & ~3) - NR_syscalls
#define syscalls_counted
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 1/9] powerpc: allocate sys_membarrier system call number
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api
Cc: linux-kernel, Mathieu Desnoyers, Benjamin Herrenschmidt,
Paul Mackerras, Michael Ellerman, linuxppc-dev
In-Reply-To: <1440698215-8355-1-git-send-email-mathieu.desnoyers@efficios.com>
Allow it to be used from SPU, since it should not have unwanted
side-effects.
[ Untested on this architecture. To try it out: fetch linux-next/akpm,
apply this patch, build/run a membarrier-enabled kernel, and do make
kselftest. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: linux-api@vger.kernel.org
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
CC: Paul Mackerras <paulus@samba.org>
CC: Michael Ellerman <mpe@ellerman.id.au>
CC: linuxppc-dev@lists.ozlabs.org
---
arch/powerpc/include/asm/systbl.h | 1 +
arch/powerpc/include/asm/unistd.h | 2 +-
arch/powerpc/include/uapi/asm/unistd.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index 4d65499..126d0c4 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -369,3 +369,4 @@ SYSCALL_SPU(bpf)
COMPAT_SYS(execveat)
PPC64ONLY(switch_endian)
SYSCALL_SPU(userfaultfd)
+SYSCALL_SPU(membarrier)
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index 4a055b6..13411be 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -12,7 +12,7 @@
#include <uapi/asm/unistd.h>
-#define __NR_syscalls 365
+#define __NR_syscalls 366
#define __NR__exit __NR_exit
#define NR_syscalls __NR_syscalls
diff --git a/arch/powerpc/include/uapi/asm/unistd.h b/arch/powerpc/include/uapi/asm/unistd.h
index 6ad58d4..6337738 100644
--- a/arch/powerpc/include/uapi/asm/unistd.h
+++ b/arch/powerpc/include/uapi/asm/unistd.h
@@ -387,5 +387,6 @@
#define __NR_execveat 362
#define __NR_switch_endian 363
#define __NR_userfaultfd 364
+#define __NR_membarrier 365
#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
--
1.9.1
^ permalink raw reply related
* [RFC PATCH 0/9] allocate sys_membarrier system call number on major archs
From: Mathieu Desnoyers @ 2015-08-27 17:56 UTC (permalink / raw)
To: Andrew Morton, linux-api; +Cc: linux-kernel, Mathieu Desnoyers
Wire up the sys_membarrier system call on all major architectures.
This would need testing from architecture maintainers and/or
enthusiasts. Posting as RFC for now. Could be picked into Andrew's
tree once we get the Tested-by tags.
Thanks,
Mathieu
Mathieu Desnoyers (9):
powerpc: allocate sys_membarrier system call number
arm: allocate sys_membarrier system call number
arm64: allocate sys_membarrier system call number
mips: allocate sys_membarrier system call number
s390/s390x: allocate sys_membarrier system call number
sparc/sparc64: allocate sys_membarrier system call number
alpha: allocate sys_membarrier system call number
ia64: allocate sys_membarrier system call number
parisc: allocate sys_membarrier system call number
arch/alpha/include/uapi/asm/unistd.h | 1 +
arch/alpha/kernel/systbls.S | 1 +
arch/arm/include/asm/unistd.h | 2 +-
arch/arm/include/uapi/asm/unistd.h | 1 +
arch/arm/kernel/calls.S | 1 +
arch/arm64/include/asm/unistd32.h | 2 ++
arch/ia64/include/asm/unistd.h | 2 +-
arch/ia64/include/uapi/asm/unistd.h | 1 +
arch/ia64/kernel/entry.S | 1 +
arch/mips/include/uapi/asm/unistd.h | 15 +++++++++------
arch/mips/kernel/scall32-o32.S | 1 +
arch/mips/kernel/scall64-64.S | 1 +
arch/mips/kernel/scall64-n32.S | 1 +
arch/mips/kernel/scall64-o32.S | 1 +
arch/parisc/include/uapi/asm/unistd.h | 3 ++-
arch/parisc/kernel/syscall_table.S | 1 +
arch/powerpc/include/asm/systbl.h | 1 +
arch/powerpc/include/asm/unistd.h | 2 +-
arch/powerpc/include/uapi/asm/unistd.h | 1 +
arch/s390/include/uapi/asm/unistd.h | 3 ++-
arch/s390/kernel/syscalls.S | 1 +
arch/sparc/include/uapi/asm/unistd.h | 3 ++-
arch/sparc/kernel/systbls_32.S | 2 +-
arch/sparc/kernel/systbls_64.S | 4 ++--
24 files changed, 37 insertions(+), 15 deletions(-)
--
1.9.1
^ permalink raw reply
* Re: [PATCH 2/5] coresight-etm4x: Change the name of the ctxid_val to ctxid_pid
From: Mathieu Poirier @ 2015-08-27 15:54 UTC (permalink / raw)
To: Christopher Covington
Cc: Chunyan Zhang, Greg KH, Mark Brown, Serge Broslavsky, Lyra Zhang,
linux-arm-kernel@lists.infradead.org, linux-api,
linux-kernel@vger.kernel.org
In-Reply-To: <55DF2DB5.7000909@codeaurora.org>
On 27 August 2015 at 09:33, Christopher Covington <cov@codeaurora.org> wrote:
> On 08/27/2015 11:12 AM, Mathieu Poirier wrote:
>> On 26 August 2015 at 11:57, Christopher Covington <cov@codeaurora.org> wrote:
>>> On 07/07/2015 04:41 AM, Chunyan Zhang wrote:
>>>> 'ctxid_val' array was used to store the value of ETM context ID comparator
>>>> which actually stores the process ID to be traced, so using 'ctxid_pid' as
>>>> its name instead make it easier to understand.
>>>
>>> Previous discussion with some ARM folks has led me to believe there isn't a
>>> guarantee that the Context ID Register will always have a PID. Why not allow
>>> filtering on thread group ID, session ID, cgroup related identifiers, etc.?
>>
>> Coresight tracers only support contextID tracing. The HW
>> automatically does the match between the contextID comparator register
>> in the tracer with the contextID register of the core. Tracing is
>> enabled if both values match (and the tracer is configured to do so).
>
> Is there a reason to only ever allow Process IDs to be written into the
> Coresight and CPU Context ID registers? Is there anything in the hardware that
> would prevent writing, for example, Thread Group IDs into the Coresight and
> CPU Context ID registers? If there's no hardware limitation, why should there
> be kernel or device tree architecture that states or implies that patches to
> support such a use case are unacceptable?
I'm not saying your idea is unacceptable - I actually think there is
value in it. At this time the scheduler will automatically write the
PID to the contextID register when a task is running, a reality this
feature is exploiting.
There is no limitation as to what can be written to the coresight
contextID register - tracing will start for as long as the values and
mask are configured properly. I do not know the limitation imposed on
the core's contextID register (if any). We'd also have to make sure
that all the code, everywhere, relying on that information has been
modified to take into account the new semantic.
>
> Thanks,
> Christopher Covington
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
^ permalink raw reply
* Re: [PATCH 2/5] coresight-etm4x: Change the name of the ctxid_val to ctxid_pid
From: Christopher Covington @ 2015-08-27 15:33 UTC (permalink / raw)
To: Mathieu Poirier
Cc: Chunyan Zhang, Greg KH, Mark Brown, Serge Broslavsky, Lyra Zhang,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-api-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
In-Reply-To: <CANLsYkyA_C=PUDEUSbcA_Sa6Abqnxk1TP9ye6F9i0bWW_OxqiA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 08/27/2015 11:12 AM, Mathieu Poirier wrote:
> On 26 August 2015 at 11:57, Christopher Covington <cov-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org> wrote:
>> On 07/07/2015 04:41 AM, Chunyan Zhang wrote:
>>> 'ctxid_val' array was used to store the value of ETM context ID comparator
>>> which actually stores the process ID to be traced, so using 'ctxid_pid' as
>>> its name instead make it easier to understand.
>>
>> Previous discussion with some ARM folks has led me to believe there isn't a
>> guarantee that the Context ID Register will always have a PID. Why not allow
>> filtering on thread group ID, session ID, cgroup related identifiers, etc.?
>
> Coresight tracers only support contextID tracing. The HW
> automatically does the match between the contextID comparator register
> in the tracer with the contextID register of the core. Tracing is
> enabled if both values match (and the tracer is configured to do so).
Is there a reason to only ever allow Process IDs to be written into the
Coresight and CPU Context ID registers? Is there anything in the hardware that
would prevent writing, for example, Thread Group IDs into the Coresight and
CPU Context ID registers? If there's no hardware limitation, why should there
be kernel or device tree architecture that states or implies that patches to
support such a use case are unacceptable?
Thanks,
Christopher Covington
--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply
* Re: [PATCH 2/5] coresight-etm4x: Change the name of the ctxid_val to ctxid_pid
From: Mathieu Poirier @ 2015-08-27 15:12 UTC (permalink / raw)
To: Christopher Covington
Cc: Chunyan Zhang, Greg KH, Mark Brown, Serge Broslavsky, Lyra Zhang,
linux-arm-kernel@lists.infradead.org, linux-api,
linux-kernel@vger.kernel.org
In-Reply-To: <55DDFE01.50201@codeaurora.org>
On 26 August 2015 at 11:57, Christopher Covington <cov@codeaurora.org> wrote:
> On 07/07/2015 04:41 AM, Chunyan Zhang wrote:
>> 'ctxid_val' array was used to store the value of ETM context ID comparator
>> which actually stores the process ID to be traced, so using 'ctxid_pid' as
>> its name instead make it easier to understand.
>
> Previous discussion with some ARM folks has led me to believe there isn't a
> guarantee that the Context ID Register will always have a PID. Why not allow
> filtering on thread group ID, session ID, cgroup related identifiers, etc.?
Coresight tracers only support contextID tracing. The HW
automatically does the match between the contextID comparator register
in the tracer with the contextID register of the core. Tracing is
enabled if both values match (and the tracer is configured to do so).
>
>> This patch also changes the ABI, it is normally not allowed, but
>> fortunately it is a testing ABI and very new for now. Nevertheless,
>> if you don't think it should be changed, we could always add an alias
>> for userspace.
>>
>> Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
>> Reviewed-by: Mark Brown <broonie@kernel.org>
>> ---
>> .../ABI/testing/sysfs-bus-coresight-devices-etm4x | 2 +-
>> drivers/hwtracing/coresight/coresight-etm4x.c | 20 ++++++++++----------
>> drivers/hwtracing/coresight/coresight-etm4x.h | 4 ++--
>> 3 files changed, 13 insertions(+), 13 deletions(-)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
>> index 2fe2e3d..2355ed8 100644
>> --- a/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
>> +++ b/Documentation/ABI/testing/sysfs-bus-coresight-devices-etm4x
>> @@ -249,7 +249,7 @@ KernelVersion: 4.01
>> Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
>> Description: (RW) Select which context ID comparator to work with.
>>
>> -What: /sys/bus/coresight/devices/<memory_map>.etm/ctxid_val
>> +What: /sys/bus/coresight/devices/<memory_map>.etm/ctxid_pid
>> Date: April 2015
>> KernelVersion: 4.01
>> Contact: Mathieu Poirier <mathieu.poirier@linaro.org>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.c b/drivers/hwtracing/coresight/coresight-etm4x.c
>> index 1312e99..9afbda5 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.c
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.c
>> @@ -155,7 +155,7 @@ static void etm4_enable_hw(void *info)
>> drvdata->base + TRCACATRn(i));
>> }
>> for (i = 0; i < drvdata->numcidc; i++)
>> - writeq_relaxed(drvdata->ctxid_val[i],
>> + writeq_relaxed(drvdata->ctxid_pid[i],
>> drvdata->base + TRCCIDCVRn(i));
>> writel_relaxed(drvdata->ctxid_mask0, drvdata->base + TRCCIDCCTLR0);
>> writel_relaxed(drvdata->ctxid_mask1, drvdata->base + TRCCIDCCTLR1);
>> @@ -507,7 +507,7 @@ static ssize_t reset_store(struct device *dev,
>>
>> drvdata->ctxid_idx = 0x0;
>> for (i = 0; i < drvdata->numcidc; i++)
>> - drvdata->ctxid_val[i] = 0x0;
>> + drvdata->ctxid_pid[i] = 0x0;
>> drvdata->ctxid_mask0 = 0x0;
>> drvdata->ctxid_mask1 = 0x0;
>>
>> @@ -1815,7 +1815,7 @@ static ssize_t ctxid_idx_store(struct device *dev,
>> }
>> static DEVICE_ATTR_RW(ctxid_idx);
>>
>> -static ssize_t ctxid_val_show(struct device *dev,
>> +static ssize_t ctxid_pid_show(struct device *dev,
>> struct device_attribute *attr,
>> char *buf)
>> {
>> @@ -1825,12 +1825,12 @@ static ssize_t ctxid_val_show(struct device *dev,
>>
>> spin_lock(&drvdata->spinlock);
>> idx = drvdata->ctxid_idx;
>> - val = (unsigned long)drvdata->ctxid_val[idx];
>> + val = (unsigned long)drvdata->ctxid_pid[idx];
>> spin_unlock(&drvdata->spinlock);
>> return scnprintf(buf, PAGE_SIZE, "%#lx\n", val);
>> }
>>
>> -static ssize_t ctxid_val_store(struct device *dev,
>> +static ssize_t ctxid_pid_store(struct device *dev,
>> struct device_attribute *attr,
>> const char *buf, size_t size)
>> {
>> @@ -1850,11 +1850,11 @@ static ssize_t ctxid_val_store(struct device *dev,
>>
>> spin_lock(&drvdata->spinlock);
>> idx = drvdata->ctxid_idx;
>> - drvdata->ctxid_val[idx] = (u64)val;
>> + drvdata->ctxid_pid[idx] = (u64)val;
>> spin_unlock(&drvdata->spinlock);
>> return size;
>> }
>> -static DEVICE_ATTR_RW(ctxid_val);
>> +static DEVICE_ATTR_RW(ctxid_pid);
>>
>> static ssize_t ctxid_masks_show(struct device *dev,
>> struct device_attribute *attr,
>> @@ -1949,7 +1949,7 @@ static ssize_t ctxid_masks_store(struct device *dev,
>> */
>> for (j = 0; j < 8; j++) {
>> if (maskbyte & 1)
>> - drvdata->ctxid_val[i] &= ~(0xFF << (j * 8));
>> + drvdata->ctxid_pid[i] &= ~(0xFF << (j * 8));
>> maskbyte >>= 1;
>> }
>> /* Select the next ctxid comparator mask value */
>> @@ -2193,7 +2193,7 @@ static struct attribute *coresight_etmv4_attrs[] = {
>> &dev_attr_res_idx.attr,
>> &dev_attr_res_ctrl.attr,
>> &dev_attr_ctxid_idx.attr,
>> - &dev_attr_ctxid_val.attr,
>> + &dev_attr_ctxid_pid.attr,
>> &dev_attr_ctxid_masks.attr,
>> &dev_attr_vmid_idx.attr,
>> &dev_attr_vmid_val.attr,
>> @@ -2514,7 +2514,7 @@ static void etm4_init_default_data(struct etmv4_drvdata *drvdata)
>> }
>>
>> for (i = 0; i < drvdata->numcidc; i++)
>> - drvdata->ctxid_val[i] = 0x0;
>> + drvdata->ctxid_pid[i] = 0x0;
>> drvdata->ctxid_mask0 = 0x0;
>> drvdata->ctxid_mask1 = 0x0;
>>
>> diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
>> index e08e983..1e8fb36 100644
>> --- a/drivers/hwtracing/coresight/coresight-etm4x.h
>> +++ b/drivers/hwtracing/coresight/coresight-etm4x.h
>> @@ -265,7 +265,7 @@
>> * @addr_type: Current status of the comparator register.
>> * @ctxid_idx: Context ID index selector.
>> * @ctxid_size: Size of the context ID field to consider.
>> - * @ctxid_val: Value of the context ID comparator.
>> + * @ctxid_pid: Value of the context ID comparator.
>> * @ctxid_mask0:Context ID comparator mask for comparator 0-3.
>> * @ctxid_mask1:Context ID comparator mask for comparator 4-7.
>> * @vmid_idx: VM ID index selector.
>> @@ -352,7 +352,7 @@ struct etmv4_drvdata {
>> u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP];
>> u8 ctxid_idx;
>> u8 ctxid_size;
>> - u64 ctxid_val[ETMv4_MAX_CTXID_CMP];
>> + u64 ctxid_pid[ETMv4_MAX_CTXID_CMP];
>> u32 ctxid_mask0;
>> u32 ctxid_mask1;
>> u8 vmid_idx;
>>
>
>
> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
^ permalink raw reply
* Re: [PATCH v3 4/4] mm, procfs: Display VmAnon, VmFile and VmShm in /proc/pid/status
From: Vlastimil Babka @ 2015-08-27 7:22 UTC (permalink / raw)
To: Konstantin Khlebnikov, Andrew Morton, Jerome Marchand
Cc: linux-mm, linux-kernel, Hugh Dickins, Michal Hocko,
Kirill A. Shutemov, Cyrill Gorcunov, Randy Dunlap, linux-s390,
Martin Schwidefsky, Heiko Carstens, Peter Zijlstra,
Paul Mackerras, Arnaldo Carvalho de Melo, Oleg Nesterov,
Linux API, Minchan Kim
In-Reply-To: <55C20DDE.1080506@yandex-team.ru>
On 08/05/2015 03:21 PM, Konstantin Khlebnikov wrote:
> On 05.08.2015 16:01, Vlastimil Babka wrote:
>> From: Jerome Marchand <jmarchan@redhat.com>
>>
>> It's currently inconvenient to retrieve MM_ANONPAGES value from status
>> and statm files and there is no way to separate MM_FILEPAGES and
>> MM_SHMEMPAGES. Add VmAnon, VmFile and VmShm lines in /proc/<pid>/status
>> to solve these issues.
>>
>> Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> ---
>> Documentation/filesystems/proc.txt | 10 +++++++++-
>> fs/proc/task_mmu.c | 13 +++++++++++--
>> 2 files changed, 20 insertions(+), 3 deletions(-)
>>
>> diff --git a/Documentation/filesystems/proc.txt b/Documentation/filesystems/proc.txt
>> index fcf67c7..fadd1b3 100644
>> --- a/Documentation/filesystems/proc.txt
>> +++ b/Documentation/filesystems/proc.txt
>> @@ -168,6 +168,9 @@ For example, to get the status information of a process, all you have to do is
>> VmLck: 0 kB
>> VmHWM: 476 kB
>> VmRSS: 476 kB
>> + VmAnon: 352 kB
>> + VmFile: 120 kB
>> + VmShm: 4 kB
>> VmData: 156 kB
>> VmStk: 88 kB
>> VmExe: 68 kB
>> @@ -229,7 +232,12 @@ Table 1-2: Contents of the status files (as of 4.1)
>> VmSize total program size
>> VmLck locked memory size
>> VmHWM peak resident set size ("high water mark")
>> - VmRSS size of memory portions
>> + VmRSS size of memory portions. It contains the three
>> + following parts (VmRSS = VmAnon + VmFile + VmShm)
>> + VmAnon size of resident anonymous memory
>> + VmFile size of resident file mappings
>> + VmShm size of resident shmem memory (includes SysV shm,
>> + mapping of tmpfs and shared anonymous mappings)
>
> "Vm" is an acronym for Virtual Memory, but all these are not virtual.
> They are real pages. Let's leave VmRSS as is and invent better prefix
> for new fields: something like "Mem", "Pg", or no prefix at all.
No prefix would be IMHO confusing. Mem could work, but it's not exactly
consistent with the rest. I think only VmPeak and VmSize talk about
virtual memory. The rest of existing counters is about physical memory
being mapped into that virtual memory or consumed by supporting it (PTE,
PMD) or swapped out. I don't see any difference for the new counters
here, they would just stand out oddly with some new prefix IMHO.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox