Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-05-07 Thread Ravi Bangoria
Hi Masami, On 05/04/2018 07:51 PM, Ravi Bangoria wrote: > >>> +} >>> + >>> +static void sdt_increment_ref_ctr(struct trace_uprobe *tu) >>> +{ >>> + struct uprobe_map_info *info; >>> + >>> + uprobe_down_write_dup

Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-05-08 Thread Ravi Bangoria
Hi Masami, On 05/07/2018 09:26 PM, Masami Hiramatsu wrote: > On Mon, 7 May 2018 13:51:21 +0530 > Ravi Bangoria <ravi.bango...@linux.ibm.com> wrote: > >> Hi Masami, >> >> On 05/04/2018 07:51 PM, Ravi Bangoria wrote: >>>>> +} >>>>> + &

Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-05-04 Thread Ravi Bangoria
Hi Masami, On 05/04/2018 10:18 AM, Masami Hiramatsu wrote: >> +void uprobe_down_write_dup_mmap(void) >> +{ >> +percpu_down_write(_mmap_sem); >> +} >> + >> +void uprobe_up_write_dup_mmap(void) >> +{ >> +percpu_up_write(_mmap_sem); >> +} >> + > I'm not sure why these hunks are not done in

Re: [PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-05-25 Thread Ravi Bangoria
Thanks Oleg for the review, On 05/24/2018 09:56 PM, Oleg Nesterov wrote: > On 04/17, Ravi Bangoria wrote: >> >> @@ -941,6 +1091,9 @@ typedef bool (*filter_func_t)(struct uprobe_consumer >> *self, >> if (ret) >> goto err_buffer; &g

Re: [PATCH v3 0/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-05-03 Thread Ravi Bangoria
On 04/17/2018 10:02 AM, Ravi Bangoria wrote: > Userspace Statically Defined Tracepoints[1] are dtrace style markers > inside userspace applications. Applications like PostgreSQL, MySQL, > Pthread, Perl, Python, Java, Ruby, Node.js, libvirt, QEMU, glib etc > have these markers embe

[PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions

2018-03-13 Thread Ravi Bangoria
No functionality changes. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- include/linux/mm.h | 12 kernel/events/uprobes.c | 10 -- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a

[PATCH 0/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-13 Thread Ravi Bangoria
ode. RFC series can be found at: https://lkml.org/lkml/2018/2/28/76 Ravi Bangoria (8): Uprobe: Export vaddr <-> offset conversion functions mm: Prefix vma_ to vaddr_to_offset() and offset_to_vaddr() Uprobe: Rename map_info to uprobe_map_info Uprobe: Export uprobe_map_info along with

[PATCH 6/8] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-03-13 Thread Ravi Bangoria
rf # dd if=/proc/`pgrep tick`/mem bs=1 count=1 skip=$(( 0x10020036 )) 2>/dev/null | xxd 000: 00 . Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- kernel/trace/trace_uprobe.c | 105 ++

[PATCH 7/8] perf probe: Support SDT markers having reference counter (semaphore)

2018-03-13 Thread Ravi Bangoria
/tick # ./perf probe sdt_tick:loop2 # ./perf stat -e sdt_tick:loop2 /tmp/tick hi: 0 hi: 1 hi: 2 ^C Performance counter stats for '/tmp/tick': 3 sdt_tick:loop2 2.561851452 seconds time elapsed Signed-off-by: Ravi Bangoria <ravi.ba

[PATCH 8/8] trace_uprobe/sdt: Document about reference counter

2018-03-13 Thread Ravi Bangoria
No functionality changes. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- Documentation/trace/uprobetracer.txt | 16 +--- kernel/trace/trace.c | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation

[PATCH 3/8] Uprobe: Rename map_info to uprobe_map_info

2018-03-13 Thread Ravi Bangoria
map_info is very generic name, rename it to uprobe_map_info. Renaming will help to export this structure outside of the file. Also rename free_map_info() to uprobe_free_map_info() and build_map_info() to uprobe_build_map_info(). No functionality changes. Signed-off-by: Ravi Bangoria <ravi.ba

[PATCH 2/8] mm: Prefix vma_ to vaddr_to_offset() and offset_to_vaddr()

2018-03-13 Thread Ravi Bangoria
No functionality changes. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- include/linux/mm.h | 4 ++-- kernel/events/uprobes.c | 14 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 9

[PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-13 Thread Ravi Bangoria
sed for any synchronization. So we are referring it as 'reference counter' in kernel / perf code. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> Signed-off-by: Fengguang Wu <fengguang...@intel.com> [Fengguang reported/fixed build failure in RFC patch] --- include/

Re: [PATCH 3/8] Uprobe: Rename map_info to uprobe_map_info

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 10:14 PM, Steven Rostedt wrote: > On Tue, 13 Mar 2018 18:25:58 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: >> -static inline struct map_info *free_map_info(struct map_info *info) >> +static inline struct uprobe_map_info * >>

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 08:31 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> +sdt_update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d) >> +{ >> +void *kaddr; >> +struct page *page; >> +struct vm_area_struct *vma; >> +int r

Re: [PATCH 2/8] mm: Prefix vma_ to vaddr_to_offset() and offset_to_vaddr()

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 09:58 PM, Steven Rostedt wrote: > On Tue, 13 Mar 2018 18:25:57 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> No functionality changes. > Again, please add an explanation to why this patch is done. Sure. Will add. Thanks for the

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 10:18 PM, Steven Rostedt wrote: > On Tue, 13 Mar 2018 18:26:00 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> +static void sdt_increment_ref_ctr(struct trace_uprobe *tu) >> +{ >> +struct uprobe_map_info *info; &

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 07:51 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> @@ -1053,6 +1056,9 @@ int uprobe_mmap(struct vm_area_struct *vma) >> struct uprobe *uprobe, *u; >> struct inode *inode; >> >> +if (uprobe_mmap_callback) >>

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 08:00 PM, Oleg Nesterov wrote: > On 03/15, Oleg Nesterov wrote: >>> +static struct vm_area_struct * >>> +sdt_find_vma(struct mm_struct *mm, struct trace_uprobe *tu) >>> +{ >>> + struct vm_area_struct *tmp; >>> + >>> + for (tmp = mm->mmap; tmp != NULL; tmp = tmp->vm_next) >>> +

Re: [PATCH 8/8] trace_uprobe/sdt: Document about reference counter

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 06:17 PM, Masami Hiramatsu wrote: > Hi Ravi, > > On Wed, 14 Mar 2018 20:52:59 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> On 03/14/2018 07:20 PM, Masami Hiramatsu wrote: >>> On Tue, 13 Mar 2018 18:26:03

Re: [PATCH 1/8] Uprobe: Export vaddr <-> offset conversion functions

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 09:57 PM, Steven Rostedt wrote: > On Tue, 13 Mar 2018 18:25:56 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> No functionality changes. > Please add a detailed explanation why this patch is needed. All commits > should be self suffic

Re: [PATCH 6/8] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-03-14 Thread Ravi Bangoria
On 03/14/2018 07:45 PM, Masami Hiramatsu wrote: > On Tue, 13 Mar 2018 18:26:01 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> For tiny binaries/libraries, different mmap regions points to the >> same file portion. In such cases, we may

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-15 Thread Ravi Bangoria
On 03/14/2018 10:29 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> +static bool sdt_valid_vma(struct trace_uprobe *tu, struct vm_area_struct >> *vma) >> +{ >> +unsigned long vaddr = vma_offset_to_vaddr(vma, tu->ref_ctr_offset); >>

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-14 Thread Ravi Bangoria
Hi Masami, On 03/14/2018 07:18 PM, Masami Hiramatsu wrote: > Hi Ravi, > > On Tue, 13 Mar 2018 18:26:00 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> Userspace Statically Defined Tracepoints[1] are dtrace style markers >> inside user

Re: [PATCH 8/8] trace_uprobe/sdt: Document about reference counter

2018-03-14 Thread Ravi Bangoria
On 03/14/2018 07:20 PM, Masami Hiramatsu wrote: > On Tue, 13 Mar 2018 18:26:03 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> No functionality changes. > Please consider to describe what is this change and why, here. Will add in next version.

Re: [PATCH 7/8] perf probe: Support SDT markers having reference counter (semaphore)

2018-03-14 Thread Ravi Bangoria
On 03/14/2018 07:39 PM, Masami Hiramatsu wrote: > Hi Ravi, > > This code logic looks good. I just have several small comments for style. > > On Tue, 13 Mar 2018 18:26:02 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> diff --git a/tools/per

Re: [PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-10 Thread Ravi Bangoria
Hi Oleg, On 04/09/2018 06:59 PM, Oleg Nesterov wrote: > On 04/04, Ravi Bangoria wrote: >> +static void sdt_add_mm_list(struct trace_uprobe *tu, struct mm_struct *mm) >> +{ >> +struct mmu_notifier *mn; >> +struct sdt_mm_list *sml = kzalloc(sizeof(*sml), GFP_KER

Re: [PATCH v2 9/9] perf probe: Support SDT markers having reference counter (semaphore)

2018-04-09 Thread Ravi Bangoria
Hi Masami, On 04/09/2018 12:58 PM, Masami Hiramatsu wrote: > Hi Ravi, > > On Wed, 4 Apr 2018 14:01:10 +0530 > Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> wrote: > >> @@ -2054,15 +2060,21 @@ char *synthesize_probe_trace_command(struct >> probe_trace_event *t

Re: [PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-09 Thread Ravi Bangoria
Hi Oleg, On 04/09/2018 06:47 PM, Oleg Nesterov wrote: > On 04/04, Ravi Bangoria wrote: >> +static void sdt_add_mm_list(struct trace_uprobe *tu, struct mm_struct *mm) >> +{ >> +struct mmu_notifier *mn; >> +struct sdt_mm_list *sml = kzalloc(sizeof(*sml), GFP_KER

Re: [PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-09 Thread Ravi Bangoria
On 04/09/2018 07:02 PM, Ravi Bangoria wrote: > Hi Oleg, > > On 04/09/2018 06:47 PM, Oleg Nesterov wrote: >> I didn't read this version yet, just one question... >> >> So now it depends on CONFIG_MMU_NOTIFIER, yes? I do not see any changes in >> Kconfig >>

Re: [PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-10 Thread Ravi Bangoria
Hi Oleg, On 04/10/2018 04:36 PM, Oleg Nesterov wrote: > Hi Ravi, > > On 04/10, Ravi Bangoria wrote: >>> and what if __mmu_notifier_register() fails simply because signal_pending() >>> == T? >>> see mm_take_all_locks(). >>> >>> at first glan

[PATCH v3 5/9] Uprobe: Export uprobe_map_info along with uprobe_{build/free}_map_info()

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> Given the file(inode) and offset, build_map_info() finds all existing mm that map the portion of file containing offset. Exporting these functions and data structure will help to use them in other set of files. Signed-off-by: Ravi Ba

[PATCH v3 1/9] Uprobe: Export vaddr <-> offset conversion functions

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> These are generic functions which operates on file offset and virtual address. Make these functions available outside of uprobe code so that other can use it as well. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.ibm.com> Reviewe

[PATCH v3 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> Userspace Statically Defined Tracepoints[1] are dtrace style markers inside userspace applications. Applications like PostgreSQL, MySQL, Pthread, Perl, Python, Java, Ruby, Node.js, libvirt, QEMU, glib etc have these markers embedded i

[PATCH v3 3/9] Uprobe: Move mmput() into free_map_info()

2018-04-16 Thread Ravi Bangoria
From: Oleg Nesterov <o...@redhat.com> build_map_info() has a side effect like one need to perform mmput() when done with the mm. Add mmput() in free_map_info() so that user does not have to call it explicitly. Signed-off-by: Oleg Nesterov <o...@redhat.com> Signed-off-by: R

[PATCH v3 8/9] trace_uprobe/sdt: Document about reference counter

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> Reference counter gate the invocation of probe. If present, by default reference count is 0. Kernel needs to increment it before tracing the probe and decrement it when done. This is identical to semaphore in Userspace Statically D

[PATCH v3 9/9] perf probe: Support SDT markers having reference counter (semaphore)

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> With this, perf buildid-cache will save SDT markers with reference counter in probe cache. Perf probe will be able to probe markers having reference counter. Ex, # readelf -n /tmp/tick | grep -A1 loop2 Name: loop2 ... Sem

[PATCH v3 2/9] mm: Prefix vma_ to vaddr_to_offset() and offset_to_vaddr()

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> Make function names more meaningful by adding vma_ prefix to them. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.ibm.com> Reviewed-by: Jérôme Glisse <jgli...@redhat.com> --- include/linux/mm.h | 4 ++-- kernel/eve

[PATCH v3 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-16 Thread Ravi Bangoria
From: Ravi Bangoria <ravi.bango...@linux.ibm.com> When virtual memory map for binary/library is being prepared, there is no direct one to one mapping between mmap() and virtual memory area. Ex, when loader loads the library, it first calls mmap(size = total_size), where total_size is ad

[PATCH v2 2/9] mm: Prefix vma_ to vaddr_to_offset() and offset_to_vaddr()

2018-04-04 Thread Ravi Bangoria
Make function names more meaningful by adding vma_ prefix to them. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> Reviewed-by: Jérôme Glisse <jgli...@redhat.com> --- include/linux/mm.h | 4 ++-- kernel/events/uprobes.c | 14 +++--- 2 files changed,

[PATCH v2 6/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-04-04 Thread Ravi Bangoria
sed for any synchronization. So we are referring it as 'reference counter' in kernel / perf code. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> Signed-off-by: Fengguang Wu <fengguang...@intel.com> [Fengguang reported/fixed build failure in RFC patch] --- include/

[PATCH v2 1/9] Uprobe: Export vaddr <-> offset conversion functions

2018-04-04 Thread Ravi Bangoria
These are generic functions which operates on file offset and virtual address. Make these functions available outside of uprobe code so that other can use it as well. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> Reviewed-by: Jérôme Glisse <jgli...@redhat.com> --- i

[PATCH v2 0/9] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-04-04 Thread Ravi Bangoria
can be found at: https://lkml.org/lkml/2018/3/13/432 [1] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation [2] https://github.com/iovisor/bcc/issues/327#issuecomment-200576506 [3] https://lkml.org/lkml/2017/12/6/976 Oleg Nesterov (1): Uprobe: Move mmput() into free_map_info() Ra

[PATCH v2 4/9] Uprobe: Rename map_info to uprobe_map_info

2018-04-04 Thread Ravi Bangoria
map_info is very generic name, rename it to uprobe_map_info. Renaming will help to export this structure outside of the file. Also rename free_map_info() to uprobe_free_map_info() and build_map_info() to uprobe_build_map_info(). Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.

[PATCH v2 3/9] Uprobe: Move mmput() into free_map_info()

2018-04-04 Thread Ravi Bangoria
From: Oleg Nesterov <o...@redhat.com> build_map_info() has a side effect like one need to perform mmput() when done with the mm. Add mmput() in free_map_info() so that user does not have to call it explicitly. Signed-off-by: Oleg Nesterov <o...@redhat.com> Signed-off-by: R

[PATCH v2 9/9] perf probe: Support SDT markers having reference counter (semaphore)

2018-04-04 Thread Ravi Bangoria
/tick # ./perf probe sdt_tick:loop2 # ./perf stat -e sdt_tick:loop2 /tmp/tick hi: 0 hi: 1 hi: 2 ^C Performance counter stats for '/tmp/tick': 3 sdt_tick:loop2 2.561851452 seconds time elapsed Signed-off-by: Ravi Bangoria <ravi.ba

[PATCH v2 7/9] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-04-04 Thread Ravi Bangoria
bb99d8 )) 2>/dev/null | xxd 000: 00 . Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- kernel/trace/trace_uprobe.c | 105 ++-- 1 file changed, 102 insertions(+), 3 deletions(-) diff

[PATCH v2 8/9] trace_uprobe/sdt: Document about reference counter

2018-04-04 Thread Ravi Bangoria
. Signed-off-by: Ravi Bangoria <ravi.bango...@linux.vnet.ibm.com> --- Documentation/trace/uprobetracer.txt | 16 +--- kernel/trace/trace.c | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Documentation/trace/uprobetracer.txt b/Documentation

Re: [PATCH 6/8] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-03-16 Thread Ravi Bangoria
On 03/16/2018 05:42 PM, Ravi Bangoria wrote: > > On 03/15/2018 08:19 PM, Oleg Nesterov wrote: >> On 03/13, Ravi Bangoria wrote: >>> For tiny binaries/libraries, different mmap regions points to the >>> same file portion. In such cases, we may increment refere

Re: [PATCH 6/8] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-03-16 Thread Ravi Bangoria
On 03/15/2018 08:19 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> For tiny binaries/libraries, different mmap regions points to the >> same file portion. In such cases, we may increment reference counter >> multiple times. > Yes, > >> But while d

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-18 Thread Ravi Bangoria
Hi Oleg, On 03/14/2018 10:29 PM, Oleg Nesterov wrote: > On 03/13, Ravi Bangoria wrote: >> +static bool sdt_valid_vma(struct trace_uprobe *tu, struct vm_area_struct >> *vma) >> +{ >> +unsigned long vaddr = vma_offset_to_vaddr(vma, tu->ref_ctr_offset); >>

Re: [PATCH 5/8] trace_uprobe: Support SDT markers having reference count (semaphore)

2018-03-16 Thread Ravi Bangoria
On 03/16/2018 05:09 PM, Oleg Nesterov wrote: > On 03/16, Ravi Bangoria wrote: >> On 03/15/2018 08:00 PM, Oleg Nesterov wrote: >>> Note to mention that sdt_find_vma() can return NULL but the callers do >>> vma_offset_to_vaddr(vma) without any check. >> If the &q

Re: [PATCH 6/8] trace_uprobe/sdt: Fix multiple update of same reference counter

2018-03-19 Thread Ravi Bangoria
Hi Oleg, On 03/16/2018 11:20 PM, Oleg Nesterov wrote: > On 03/16, Ravi Bangoria wrote: >> On 03/15/2018 08:19 PM, Oleg Nesterov wrote: >>> On 03/13, Ravi Bangoria wrote: >>>> For tiny binaries/libraries, different mmap regions points to the >>>> same fil