All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>, srikar@linux.vnet.ibm.com
Cc: rostedt@goodmis.org, mhiramat@kernel.org, peterz@infradead.org,
	mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, linux-kernel@vger.kernel.org,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	ananth@linux.vnet.ibm.com, alexis.berlemont@gmail.com,
	naveen.n.rao@linux.vnet.ibm.com,
	linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org,
	linux@armlinux.org.uk, ralf@linux-mips.org, paul.burton@mips.com,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH v5 06/10] Uprobes: Support SDT markers having reference count (semaphore)
Date: Wed, 11 Jul 2018 14:14:25 +0530	[thread overview]
Message-ID: <6e3ff60b-267a-d49d-4ebb-c4264f9c034b@linux.ibm.com> (raw)
In-Reply-To: <20180710152527.GA3616@redhat.com>

Hi Oleg,

On 07/10/2018 08:55 PM, Oleg Nesterov wrote:
> Hi Ravi,
> 
> On 07/04, Ravi Bangoria wrote:
>>
>>> Now I understand what did you mean by "for each consumer". So if we move this logic
>>> into install/remove_breakpoint as I tried to suggest, we will also need another error
>>> code for the case when verify_opcode() returns false.
>>
>> Ok so if we can use verify_opcode() inside install_breakpoint(), we can probably
>> move implementation logic in install/remove_breakpoint(). Let me explore that more.
> 
> No, sorry for confusion, I meant another thing... But please forget. If we rely on
> verify_opcode() I no longer think it would be more clean to move this logic into
> install/remove_breakpoint.
> 
> However, I still think it would be better to avoid uprobe exporting and modifying
> set_swbp/set_orig_insn. May be we can simply kill both set_swbp() and set_orig_insn(),
> I'll re-check...

Good that you bring this up. Actually, we can implement same logic
without exporting uprobe. We can do "uprobe = container_of(arch_uprobe)"
in uprobe_write_opcode(). No need to export struct uprobe outside,
no need to change set_swbp() / set_orig_insn() syntax. Just that we
need to pass arch_uprobe object to uprobe_write_opcode().


But, I wanted to discuss about making ref_ctr_offset a uprobe property
or a consumer property, before posting v6:

If we make it a consumer property, the design becomes flexible for
user. User will have an option to either depend on kernel to handle
reference counter or he can create normal uprobe and manipulate
reference counter on his own. This will not require any changes to
existing tools. With this approach we need to increment / decrement
reference counter for each consumer. But, because of the fact that our
install_breakpoint() / remove_breakpoint() are not balanced, we have
to keep track of which reference counter have been updated in which
mm, for which uprobe and for which consumer. I.e. Maintain a list of
{uprobe, consumer, mm}. This will make kernel implementation quite
complex because there are chances of races. What we gain in return
is flexibility for users. Please let me know if there are any other
advantages of this approach.

By making it a uprobe property, we are forcing user to use
uprobe_register_refctr() for uprobes having reference counter. Because
we don't allow same uprobe with multiple reference counter and thus
user can't use both uprobe_register_refctr() and uprobe_register() in
parallel for same uprobe. Which means user does not have a flexibility
to create normal uprobe with uprobe_register() and maintain reference
counter on his own. But kernel implementation becomes simple with this
approach. Though, this will require changes in tools which already
supports SDT events, systemtap and bcc I'm aware of. But AFAICS, the
change should not be major. In fact, the change should make tool code
simpler because they don't have to worry about maintaining reference
counter.

Third options: How about allowing 0 as a special value for reference
counter? I mean allow uprobe_register() and uprobe_register_refctr()
in parallel but do not allow two uprobe_register_refctr() with two
different reference counter. If we can do this, the issue of forcing
legacy user to use uprobe_register_refctr() will be solved. I.e. no
change needed on tools side and still kernel implementation will
remain simple. I'll explore this option.

Let me know your thoughts.

Thanks,
Ravi

PS: We can't abuse MSB with first approach because any userspace tool
can also abuse MSB in parallel. Probably, we can abuse MSB in second
and third approach, though, there is no need to.


WARNING: multiple messages have this Message-ID (diff)
From: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>, srikar@linux.vnet.ibm.com
Cc: rostedt@goodmis.org, mhiramat@kernel.org, peterz@infradead.org,
	mingo@redhat.com, acme@kernel.org,
	alexander.shishkin@linux.intel.com, jolsa@redhat.com,
	namhyung@kernel.org, linux-kernel@vger.kernel.org,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	ananth@linux.vnet.ibm.com, alexis.berlemont@gmail.com,
	naveen.n.rao@linux.vnet.ibm.com,
	linux-arm-kernel@lists.infradead.org, linux-mips@linux-mips.org,
	linux@armlinux.org.uk, ralf@linux-mips.org, paul.burton@mips.com,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Subject: Re: [PATCH v5 06/10] Uprobes: Support SDT markers having reference count (semaphore)
Date: Wed, 11 Jul 2018 14:14:25 +0530	[thread overview]
Message-ID: <6e3ff60b-267a-d49d-4ebb-c4264f9c034b@linux.ibm.com> (raw)
In-Reply-To: <20180710152527.GA3616@redhat.com>

Hi Oleg,

On 07/10/2018 08:55 PM, Oleg Nesterov wrote:
> Hi Ravi,
> 
> On 07/04, Ravi Bangoria wrote:
>>
>>> Now I understand what did you mean by "for each consumer". So if we move this logic
>>> into install/remove_breakpoint as I tried to suggest, we will also need another error
>>> code for the case when verify_opcode() returns false.
>>
>> Ok so if we can use verify_opcode() inside install_breakpoint(), we can probably
>> move implementation logic in install/remove_breakpoint(). Let me explore that more.
> 
> No, sorry for confusion, I meant another thing... But please forget. If we rely on
> verify_opcode() I no longer think it would be more clean to move this logic into
> install/remove_breakpoint.
> 
> However, I still think it would be better to avoid uprobe exporting and modifying
> set_swbp/set_orig_insn. May be we can simply kill both set_swbp() and set_orig_insn(),
> I'll re-check...

Good that you bring this up. Actually, we can implement same logic
without exporting uprobe. We can do "uprobe = container_of(arch_uprobe)"
in uprobe_write_opcode(). No need to export struct uprobe outside,
no need to change set_swbp() / set_orig_insn() syntax. Just that we
need to pass arch_uprobe object to uprobe_write_opcode().


But, I wanted to discuss about making ref_ctr_offset a uprobe property
or a consumer property, before posting v6:

If we make it a consumer property, the design becomes flexible for
user. User will have an option to either depend on kernel to handle
reference counter or he can create normal uprobe and manipulate
reference counter on his own. This will not require any changes to
existing tools. With this approach we need to increment / decrement
reference counter for each consumer. But, because of the fact that our
install_breakpoint() / remove_breakpoint() are not balanced, we have
to keep track of which reference counter have been updated in which
mm, for which uprobe and for which consumer. I.e. Maintain a list of
{uprobe, consumer, mm}. This will make kernel implementation quite
complex because there are chances of races. What we gain in return
is flexibility for users. Please let me know if there are any other
advantages of this approach.

By making it a uprobe property, we are forcing user to use
uprobe_register_refctr() for uprobes having reference counter. Because
we don't allow same uprobe with multiple reference counter and thus
user can't use both uprobe_register_refctr() and uprobe_register() in
parallel for same uprobe. Which means user does not have a flexibility
to create normal uprobe with uprobe_register() and maintain reference
counter on his own. But kernel implementation becomes simple with this
approach. Though, this will require changes in tools which already
supports SDT events, systemtap and bcc I'm aware of. But AFAICS, the
change should not be major. In fact, the change should make tool code
simpler because they don't have to worry about maintaining reference
counter.

Third options: How about allowing 0 as a special value for reference
counter? I mean allow uprobe_register() and uprobe_register_refctr()
in parallel but do not allow two uprobe_register_refctr() with two
different reference counter. If we can do this, the issue of forcing
legacy user to use uprobe_register_refctr() will be solved. I.e. no
change needed on tools side and still kernel implementation will
remain simple. I'll explore this option.

Let me know your thoughts.

Thanks,
Ravi

PS: We can't abuse MSB with first approach because any userspace tool
can also abuse MSB in parallel. Probably, we can abuse MSB in second
and third approach, though, there is no need to.

--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: ravi.bangoria@linux.ibm.com (Ravi Bangoria)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 06/10] Uprobes: Support SDT markers having reference count (semaphore)
Date: Wed, 11 Jul 2018 14:14:25 +0530	[thread overview]
Message-ID: <6e3ff60b-267a-d49d-4ebb-c4264f9c034b@linux.ibm.com> (raw)
In-Reply-To: <20180710152527.GA3616@redhat.com>

Hi Oleg,

On 07/10/2018 08:55 PM, Oleg Nesterov wrote:
> Hi Ravi,
> 
> On 07/04, Ravi Bangoria wrote:
>>
>>> Now I understand what did you mean by "for each consumer". So if we move this logic
>>> into install/remove_breakpoint as I tried to suggest, we will also need another error
>>> code for the case when verify_opcode() returns false.
>>
>> Ok so if we can use verify_opcode() inside install_breakpoint(), we can probably
>> move implementation logic in install/remove_breakpoint(). Let me explore that more.
> 
> No, sorry for confusion, I meant another thing... But please forget. If we rely on
> verify_opcode() I no longer think it would be more clean to move this logic into
> install/remove_breakpoint.
> 
> However, I still think it would be better to avoid uprobe exporting and modifying
> set_swbp/set_orig_insn. May be we can simply kill both set_swbp() and set_orig_insn(),
> I'll re-check...

Good that you bring this up. Actually, we can implement same logic
without exporting uprobe. We can do "uprobe = container_of(arch_uprobe)"
in uprobe_write_opcode(). No need to export struct uprobe outside,
no need to change set_swbp() / set_orig_insn() syntax. Just that we
need to pass arch_uprobe object to uprobe_write_opcode().


But, I wanted to discuss about making ref_ctr_offset a uprobe property
or a consumer property, before posting v6:

If we make it a consumer property, the design becomes flexible for
user. User will have an option to either depend on kernel to handle
reference counter or he can create normal uprobe and manipulate
reference counter on his own. This will not require any changes to
existing tools. With this approach we need to increment / decrement
reference counter for each consumer. But, because of the fact that our
install_breakpoint() / remove_breakpoint() are not balanced, we have
to keep track of which reference counter have been updated in which
mm, for which uprobe and for which consumer. I.e. Maintain a list of
{uprobe, consumer, mm}. This will make kernel implementation quite
complex because there are chances of races. What we gain in return
is flexibility for users. Please let me know if there are any other
advantages of this approach.

By making it a uprobe property, we are forcing user to use
uprobe_register_refctr() for uprobes having reference counter. Because
we don't allow same uprobe with multiple reference counter and thus
user can't use both uprobe_register_refctr() and uprobe_register() in
parallel for same uprobe. Which means user does not have a flexibility
to create normal uprobe with uprobe_register() and maintain reference
counter on his own. But kernel implementation becomes simple with this
approach. Though, this will require changes in tools which already
supports SDT events, systemtap and bcc I'm aware of. But AFAICS, the
change should not be major. In fact, the change should make tool code
simpler because they don't have to worry about maintaining reference
counter.

Third options: How about allowing 0 as a special value for reference
counter? I mean allow uprobe_register() and uprobe_register_refctr()
in parallel but do not allow two uprobe_register_refctr() with two
different reference counter. If we can do this, the issue of forcing
legacy user to use uprobe_register_refctr() will be solved. I.e. no
change needed on tools side and still kernel implementation will
remain simple. I'll explore this option.

Let me know your thoughts.

Thanks,
Ravi

PS: We can't abuse MSB with first approach because any userspace tool
can also abuse MSB in parallel. Probably, we can abuse MSB in second
and third approach, though, there is no need to.

  reply	other threads:[~2018-07-11  8:44 UTC|newest]

Thread overview: 152+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-28  5:21 [PATCH v5 00/10] Uprobes: Support SDT markers having reference count (semaphore) Ravi Bangoria
2018-06-28  5:21 ` Ravi Bangoria
2018-06-28  5:21 ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 01/10] Uprobes: Move uprobe structure to uprobe.h Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 02/10] Uprobes: Simplify uprobe_register() body Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 03/10] Uprobe: Change set_swbp definition Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 04/10] Uprobe: Change set_orig_insn definition Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 05/10] Uprobe: Change uprobe_write_opcode definition Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 06/10] Uprobes: Support SDT markers having reference count (semaphore) Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28 19:51   ` Oleg Nesterov
2018-06-28 19:51     ` Oleg Nesterov
2018-06-28 19:51     ` Oleg Nesterov
2018-06-29  3:23     ` Ravi Bangoria
2018-06-29  3:23       ` Ravi Bangoria
2018-06-29  3:23       ` Ravi Bangoria
2018-07-01 21:09   ` Oleg Nesterov
2018-07-01 21:09     ` Oleg Nesterov
2018-07-01 21:09     ` Oleg Nesterov
2018-07-02  5:16     ` Ravi Bangoria
2018-07-02  5:16       ` Ravi Bangoria
2018-07-02  5:16       ` Ravi Bangoria
2018-07-02 18:01       ` Oleg Nesterov
2018-07-02 18:01         ` Oleg Nesterov
2018-07-02 18:01         ` Oleg Nesterov
2018-07-03  5:30         ` Ravi Bangoria
2018-07-03  5:30           ` Ravi Bangoria
2018-07-03  5:30           ` Ravi Bangoria
2018-07-03  6:16           ` Srikar Dronamraju
2018-07-03  6:16             ` Srikar Dronamraju
2018-07-03  6:16             ` Srikar Dronamraju
2018-07-03  7:43             ` Ravi Bangoria
2018-07-03  7:43               ` Ravi Bangoria
2018-07-03  7:43               ` Ravi Bangoria
2018-07-04  9:16               ` Srikar Dronamraju
2018-07-04  9:16                 ` Srikar Dronamraju
2018-07-04  9:16                 ` Srikar Dronamraju
2018-07-04  9:24                 ` Ravi Bangoria
2018-07-04  9:24                   ` Ravi Bangoria
2018-07-04  9:24                   ` Ravi Bangoria
2018-07-03  8:11           ` Ravi Bangoria
2018-07-03  8:11             ` Ravi Bangoria
2018-07-03  8:11             ` Ravi Bangoria
2018-07-03 16:36           ` Oleg Nesterov
2018-07-03 16:36             ` Oleg Nesterov
2018-07-03 16:36             ` Oleg Nesterov
2018-07-03 17:25             ` Oleg Nesterov
2018-07-03 17:25               ` Oleg Nesterov
2018-07-03 17:25               ` Oleg Nesterov
2018-07-04  4:53               ` Ravi Bangoria
2018-07-04  4:53                 ` Ravi Bangoria
2018-07-04  4:53                 ` Ravi Bangoria
2018-07-10 15:25                 ` Oleg Nesterov
2018-07-10 15:25                   ` Oleg Nesterov
2018-07-10 15:25                   ` Oleg Nesterov
2018-07-11  8:44                   ` Ravi Bangoria [this message]
2018-07-11  8:44                     ` Ravi Bangoria
2018-07-11  8:44                     ` Ravi Bangoria
2018-07-11  9:52                     ` Ravi Bangoria
2018-07-11  9:52                       ` Ravi Bangoria
2018-07-11  9:52                       ` Ravi Bangoria
2018-07-12 14:58                     ` Oleg Nesterov
2018-07-12 14:58                       ` Oleg Nesterov
2018-07-12 14:58                       ` Oleg Nesterov
2018-07-12 19:53                       ` Song Liu
2018-07-12 19:53                         ` Song Liu
2018-07-12 19:53                         ` Song Liu
2018-07-12 19:53                         ` Song Liu
2018-07-13  7:55                         ` Ravi Bangoria
2018-07-13  7:55                           ` Ravi Bangoria
2018-07-13  7:55                           ` Ravi Bangoria
2018-07-13 23:50                           ` Song Liu
2018-07-13 23:50                             ` Song Liu
2018-07-13 23:50                             ` Song Liu
2018-07-13 23:50                             ` Song Liu
2018-07-16  8:20                             ` Ravi Bangoria
2018-07-16  8:20                               ` Ravi Bangoria
2018-07-16  8:20                               ` Ravi Bangoria
2018-07-16  8:51                             ` Ravi Bangoria
2018-07-16  8:51                               ` Ravi Bangoria
2018-07-16  8:51                               ` Ravi Bangoria
2018-07-13  5:39                       ` Ravi Bangoria
2018-07-13  5:39                         ` Ravi Bangoria
2018-07-13  5:39                         ` Ravi Bangoria
2018-07-04  4:49             ` Ravi Bangoria
2018-07-04  4:49               ` Ravi Bangoria
2018-07-04  4:49               ` Ravi Bangoria
2018-07-03 17:12           ` Oleg Nesterov
2018-07-03 17:12             ` Oleg Nesterov
2018-07-03 17:12             ` Oleg Nesterov
2018-07-03 18:23             ` Oleg Nesterov
2018-07-03 18:23               ` Oleg Nesterov
2018-07-03 18:23               ` Oleg Nesterov
2018-07-04  5:25               ` Ravi Bangoria
2018-07-04  5:25                 ` Ravi Bangoria
2018-07-04  5:25                 ` Ravi Bangoria
2018-07-02 16:01   ` Srikar Dronamraju
2018-07-02 16:01     ` Srikar Dronamraju
2018-07-02 16:01     ` Srikar Dronamraju
2018-07-02 18:05     ` Oleg Nesterov
2018-07-02 18:05       ` Oleg Nesterov
2018-07-02 18:05       ` Oleg Nesterov
2018-07-03  6:29     ` Ravi Bangoria
2018-07-03  6:29       ` Ravi Bangoria
2018-07-03  6:29       ` Ravi Bangoria
2018-07-03 19:26       ` Oleg Nesterov
2018-07-03 19:26         ` Oleg Nesterov
2018-07-03 19:26         ` Oleg Nesterov
2018-07-04  5:26         ` Ravi Bangoria
2018-07-04  5:26           ` Ravi Bangoria
2018-07-04  5:26           ` Ravi Bangoria
2018-07-04  6:07     ` Ravi Bangoria
2018-07-04  6:07       ` Ravi Bangoria
2018-07-04  6:07       ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 07/10] trace_uprobe/sdt: Prevent multiple reference counter for same uprobe Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 08/10] Uprobes/sdt: " Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 09/10] Uprobes/sdt: Document about reference counter Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-07-02 14:54   ` Srikar Dronamraju
2018-07-02 14:54     ` Srikar Dronamraju
2018-07-02 14:54     ` Srikar Dronamraju
2018-07-03  7:50     ` Ravi Bangoria
2018-07-03  7:50       ` Ravi Bangoria
2018-07-03  7:50       ` Ravi Bangoria
2018-06-28  5:22 ` [PATCH v5 10/10] perf probe: Support SDT markers having reference counter (semaphore) Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-06-28  5:22   ` Ravi Bangoria
2018-07-02 14:45   ` Srikar Dronamraju
2018-07-02 14:45     ` Srikar Dronamraju
2018-07-02 14:45     ` Srikar Dronamraju
2018-07-02 14:57   ` Srikar Dronamraju
2018-07-02 14:57     ` Srikar Dronamraju
2018-07-02 14:57     ` Srikar Dronamraju
2018-07-03  8:00     ` Ravi Bangoria
2018-07-03  8:00       ` Ravi Bangoria
2018-07-03  8:00       ` Ravi Bangoria

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=6e3ff60b-267a-d49d-4ebb-c4264f9c034b@linux.ibm.com \
    --to=ravi.bangoria@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=alexis.berlemont@gmail.com \
    --cc=ananth@linux.vnet.ibm.com \
    --cc=corbet@lwn.net \
    --cc=jolsa@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux@armlinux.org.uk \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=oleg@redhat.com \
    --cc=paul.burton@mips.com \
    --cc=peterz@infradead.org \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.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.