All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	mingo@redhat.com, a.p.zijlstra@chello.nl, peterz@infradead.org,
	anton@redhat.com, rostedt@goodmis.org, tglx@linutronix.de,
	oleg@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, jkenisto@us.ibm.com,
	andi@firstfloor.org, hch@infradead.org, ananth@in.ibm.com,
	vda.linux@googlemail.com, masami.hiramatsu.pt@hitachi.com,
	acme@infradead.org, sfr@canb.auug.org.au, roland@hack.frob.com,
	mingo@elte.hu, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:perf/uprobes] uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints
Date: Tue, 22 May 2012 11:31:33 +0530	[thread overview]
Message-ID: <20120522060133.GB10829@linux.vnet.ibm.com> (raw)
In-Reply-To: <CA+55aFw5ccuvvtyf6iuuw-Finr79ZkPxgCxL5jNvdnX5oMYkgg@mail.gmail.com>

> 
> That said, I think that's true of uprobes too. Why the f*ck would
> uprobes do it's "munmap" operation when we walk the page tables? This
> function was called by more than just the actual unmapping, it was
> called by stuff that wants to zap the pages but leave the mapping
> around.
> 

This was pointed out by Oleg earlier and I had moved the code to
unlink_file_vma.

However by the time unlink_file_vma() is called, the pages would
have been unmapped (in unmap_vmas()) and the task->rss_stat counts
accounted (in zap_pte_range()).

If the exiting process has probepoints, uprobe_munmap() checks if the
breakpoint instruction was around before decrementing the probe count.
This check results in a file backed page being re-read by
uprobe_munmap() and also it cannot find the breakpoint (because we read
a file backed page).

i.e 

1. The task->rss_stat counts gets incremented again because we have read
a page.

2. mm->uprobes_state.count which should have decremented, doesnt get
decremented as uprobe_munmap fails to see the breakpoint.

Hence I had to move back the callback to zap pages so that we do the
cleanup before the task->rss_stat counts are accounted.

That said, Oleg has a in-works patch/idea for removing uprobe_munmap and
mm->uprobes_state.count, which when done, will remove the
uprobe_munmap hook. https://lkml.org/lkml/2012/4/16/594

Please do let me know if you have better ideas to handle this.

-- 
Thanks and Regards
Srikar

--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	mingo@redhat.com, a.p.zijlstra@chello.nl, peterz@infradead.org,
	anton@redhat.com, rostedt@goodmis.org, tglx@linutronix.de,
	oleg@redhat.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, hpa@zytor.com, jkenisto@us.ibm.com,
	andi@firstfloor.org, hch@infradead.org, ananth@in.ibm.com,
	vda.linux@googlemail.com, masami.hiramatsu.pt@hitachi.com,
	acme@infradead.org, sfr@canb.auug.org.au, roland@hack.frob.com,
	mingo@elte.hu, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:perf/uprobes] uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints
Date: Tue, 22 May 2012 11:31:33 +0530	[thread overview]
Message-ID: <20120522060133.GB10829@linux.vnet.ibm.com> (raw)
In-Reply-To: <CA+55aFw5ccuvvtyf6iuuw-Finr79ZkPxgCxL5jNvdnX5oMYkgg@mail.gmail.com>

> 
> That said, I think that's true of uprobes too. Why the f*ck would
> uprobes do it's "munmap" operation when we walk the page tables? This
> function was called by more than just the actual unmapping, it was
> called by stuff that wants to zap the pages but leave the mapping
> around.
> 

This was pointed out by Oleg earlier and I had moved the code to
unlink_file_vma.

However by the time unlink_file_vma() is called, the pages would
have been unmapped (in unmap_vmas()) and the task->rss_stat counts
accounted (in zap_pte_range()).

If the exiting process has probepoints, uprobe_munmap() checks if the
breakpoint instruction was around before decrementing the probe count.
This check results in a file backed page being re-read by
uprobe_munmap() and also it cannot find the breakpoint (because we read
a file backed page).

i.e 

1. The task->rss_stat counts gets incremented again because we have read
a page.

2. mm->uprobes_state.count which should have decremented, doesnt get
decremented as uprobe_munmap fails to see the breakpoint.

Hence I had to move back the callback to zap pages so that we do the
cleanup before the task->rss_stat counts are accounted.

That said, Oleg has a in-works patch/idea for removing uprobe_munmap and
mm->uprobes_state.count, which when done, will remove the
uprobe_munmap hook. https://lkml.org/lkml/2012/4/16/594

Please do let me know if you have better ideas to handle this.

-- 
Thanks and Regards
Srikar


  parent reply	other threads:[~2012-05-22  6:03 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-02 14:18 [PATCH v10 3.3-rc2 0/9] Uprobes patchset with perf probe support Srikar Dronamraju
2012-02-02 14:18 ` Srikar Dronamraju
2012-02-02 14:18 ` [PATCH v10 3.3-rc2 1/9] uprobes: Install and remove breakpoints Srikar Dronamraju
2012-02-02 14:18   ` Srikar Dronamraju
2012-02-03 12:01   ` Masami Hiramatsu
2012-02-03 12:01     ` Masami Hiramatsu
2012-02-07 17:17   ` Srikar Dronamraju
2012-02-07 17:17     ` Srikar Dronamraju
2012-02-08  9:40     ` Denys Vlasenko
2012-02-08  9:40       ` Denys Vlasenko
2012-02-08  9:40       ` Srikar Dronamraju
2012-02-08  9:40         ` Srikar Dronamraju
2012-02-09  1:27       ` Masami Hiramatsu
2012-02-09  1:27         ` Masami Hiramatsu
2012-02-09  6:37         ` Srikar Dronamraju
2012-02-09  6:37           ` Srikar Dronamraju
2012-02-09  7:53           ` Ingo Molnar
2012-02-09  7:53             ` Ingo Molnar
2012-02-09  8:14             ` Srikar Dronamraju
2012-02-09  8:14               ` Srikar Dronamraju
2012-02-09  8:17           ` Masami Hiramatsu
2012-02-09  8:17             ` Masami Hiramatsu
2012-02-09  8:27             ` Srikar Dronamraju
2012-02-09  8:27               ` Srikar Dronamraju
2012-02-08 14:08     ` Srikar Dronamraju
2012-02-08 14:08       ` Srikar Dronamraju
2012-02-09  9:26       ` [PATCH v10 take 3 " Srikar Dronamraju
2012-02-09  9:26         ` Srikar Dronamraju
2012-02-17  9:58         ` [tip:perf/uprobes] uprobes, mm, x86: Add the ability to install and remove uprobes breakpoints tip-bot for Srikar Dronamraju
2012-02-17  9:58           ` tip-bot for Srikar Dronamraju
2012-05-21 21:37           ` Andrew Morton
2012-05-21 21:37             ` Andrew Morton
2012-05-21 22:00             ` Linus Torvalds
2012-05-21 22:00               ` Linus Torvalds
2012-05-21 22:13               ` Andrew Morton
2012-05-21 22:13                 ` Andrew Morton
2012-05-22  1:16                 ` Stephen Rothwell
2012-05-22  2:27                   ` Andrew Morton
2012-05-22  2:27                     ` Andrew Morton
2012-05-22  6:50                     ` Stephen Rothwell
2012-05-23  0:37                 ` Stephen Rothwell
2012-05-22  1:10               ` Stephen Rothwell
2012-05-22  6:01               ` Srikar Dronamraju [this message]
2012-05-22  6:01                 ` Srikar Dronamraju
2012-05-22  8:05             ` Srikar Dronamraju
2012-05-22  8:05               ` Srikar Dronamraju
2012-02-02 14:19 ` [PATCH v10 3.3-rc2 2/9] uprobes: handle breakpoint and signal step exception Srikar Dronamraju
2012-02-02 14:19   ` Srikar Dronamraju
2012-02-02 14:19 ` [PATCH v10 3.3-rc2 3/9] uprobes: slot allocation Srikar Dronamraju
2012-02-02 14:19   ` Srikar Dronamraju
2012-02-02 14:19 ` [PATCH v10 3.3-rc2 4/9] uprobes: counter to optimize probe hits Srikar Dronamraju
2012-02-02 14:19   ` Srikar Dronamraju
2012-02-02 14:19 ` [PATCH v10 3.3-rc2 5/9] tracing: modify is_delete, is_return from ints to bool Srikar Dronamraju
2012-02-02 14:19   ` Srikar Dronamraju
2012-02-02 14:20 ` [PATCH v10 3.3-rc2 6/9] tracing: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2012-02-02 14:20   ` Srikar Dronamraju
2012-02-02 14:20 ` [PATCH v10 3.3-rc2 7/9] tracing: uprobes trace_event interface Srikar Dronamraju
2012-02-02 14:20   ` Srikar Dronamraju
2012-02-02 14:20 ` [PATCH v10 3.3-rc2 8/9] perf: rename target_module to target Srikar Dronamraju
2012-02-02 14:20   ` Srikar Dronamraju
2012-02-07 19:33   ` [tip:perf/core] perf probe: Rename " tip-bot for Srikar Dronamraju
2012-02-07 19:33     ` tip-bot for Srikar Dronamraju
2012-02-02 14:20 ` [PATCH v10 3.3-rc2 9/9] perf: perf interface for uprobes Srikar Dronamraju
2012-02-02 14:20   ` Srikar Dronamraju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120522060133.GB10829@linux.vnet.ibm.com \
    --to=srikar@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=andi@firstfloor.org \
    --cc=anton@redhat.com \
    --cc=hch@infradead.org \
    --cc=hpa@zytor.com \
    --cc=jkenisto@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=roland@hack.frob.com \
    --cc=rostedt@goodmis.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=vda.linux@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.